Don't override MODULEPATH with PATH, PATH has no modulefiles PEP8 compliance
This commit is contained in:
parent
9271c69b5d
commit
3d54c3c689
@ -23,7 +23,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
import re
|
import re
|
||||||
import os
|
|
||||||
|
|
||||||
from spack.architecture import OperatingSystem
|
from spack.architecture import OperatingSystem
|
||||||
from spack.util.executable import *
|
from spack.util.executable import *
|
||||||
@ -67,17 +66,10 @@ def find_compiler(self, cmp_cls, *paths):
|
|||||||
modulecmd = which('modulecmd')
|
modulecmd = which('modulecmd')
|
||||||
modulecmd.add_default_arg('python')
|
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(
|
output = modulecmd(
|
||||||
'avail', cmp_cls.PrgEnv_compiler, output=str, error=str)
|
'avail', cmp_cls.PrgEnv_compiler, output=str, error=str)
|
||||||
matches = re.findall(
|
version_regex = r'(%s)/([\d\.]+[\d])' % cmp_cls.PrgEnv_compiler
|
||||||
r'(%s)/([\d\.]+[\d])' % cmp_cls.PrgEnv_compiler, output)
|
matches = re.findall(version_regex, output)
|
||||||
for name, version in matches:
|
for name, version in matches:
|
||||||
v = version
|
v = version
|
||||||
comp = cmp_cls(
|
comp = cmp_cls(
|
||||||
@ -87,8 +79,4 @@ def find_compiler(self, cmp_cls, *paths):
|
|||||||
|
|
||||||
compilers.append(comp)
|
compilers.append(comp)
|
||||||
|
|
||||||
# Restore modulepath environment variable
|
|
||||||
if paths:
|
|
||||||
os.environ['MODULEPATH'] = old_modulepath
|
|
||||||
|
|
||||||
return compilers
|
return compilers
|
||||||
|
Loading…
Reference in New Issue
Block a user