From 3d54c3c689ac17366325c5a48e8b94f667414f71 Mon Sep 17 00:00:00 2001 From: Mario Melara Date: Thu, 5 Jan 2017 11:15:38 -0800 Subject: Correct env vars for modulecmd; Fixes #1481 (#2745) Don't override MODULEPATH with PATH, PATH has no modulefiles PEP8 compliance --- lib/spack/spack/operating_systems/cnl.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/operating_systems/cnl.py b/lib/spack/spack/operating_systems/cnl.py index 790090d9db..7acab1cbcb 100644 --- a/lib/spack/spack/operating_systems/cnl.py +++ b/lib/spack/spack/operating_systems/cnl.py @@ -23,7 +23,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import re -import os from spack.architecture import OperatingSystem from spack.util.executable import * @@ -67,17 +66,10 @@ class Cnl(OperatingSystem): modulecmd = which('modulecmd') modulecmd.add_default_arg('python') - # Save the environment variable to restore later - old_modulepath = os.environ['MODULEPATH'] - # if given any explicit paths, search them for module files too - if paths: - module_paths = ':' + ':'.join(p for p in paths) - os.environ['MODULEPATH'] = module_paths - output = modulecmd( 'avail', cmp_cls.PrgEnv_compiler, output=str, error=str) - matches = re.findall( - r'(%s)/([\d\.]+[\d])' % cmp_cls.PrgEnv_compiler, output) + version_regex = r'(%s)/([\d\.]+[\d])' % cmp_cls.PrgEnv_compiler + matches = re.findall(version_regex, output) for name, version in matches: v = version comp = cmp_cls( @@ -87,8 +79,4 @@ class Cnl(OperatingSystem): compilers.append(comp) - # Restore modulepath environment variable - if paths: - os.environ['MODULEPATH'] = old_modulepath - return compilers -- cgit v1.2.3-60-g2f50