diff options
author | Gregory Becker <becker33@llnl.gov> | 2015-11-11 10:31:37 -0800 |
---|---|---|
committer | Gregory Becker <becker33@llnl.gov> | 2015-11-11 10:31:37 -0800 |
commit | 5347f460b4f2ce8ad64f6ec225779c2a2f944ad4 (patch) | |
tree | 0c01b13ef191737708ce45cb2873ba441aaa46a8 /lib | |
parent | 51b69ef00b947f4cf1801358b1a5da413d0b21bc (diff) | |
download | spack-5347f460b4f2ce8ad64f6ec225779c2a2f944ad4.tar.gz spack-5347f460b4f2ce8ad64f6ec225779c2a2f944ad4.tar.bz2 spack-5347f460b4f2ce8ad64f6ec225779c2a2f944ad4.tar.xz spack-5347f460b4f2ce8ad64f6ec225779c2a2f944ad4.zip |
adding module find to find command
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/compiler.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py index 4ce6e3f11d..e4bfeea608 100644 --- a/lib/spack/spack/compiler.py +++ b/lib/spack/spack/compiler.py @@ -106,7 +106,7 @@ class Compiler(object): PrgEnv_compiler = None - def __init__(self, cspec, cc, cxx, f77, fc, module=None): + def __init__(self, cspec, cc, cxx, f77, fc, modules=None): def check(exe): if exe is None: return None @@ -119,7 +119,7 @@ class Compiler(object): self.fc = check(fc) self.spec = cspec - self.modules = modules.split() + self.modules = modules @@ -216,6 +216,10 @@ class Compiler(object): @classmethod def find(cls, *path): + return cls.find_in_path(*path) + cls.find_in_modules() + + @classmethod + def find_in_path(cls, *path): """Try to find this type of compiler in the user's environment. For each set of compilers found, this returns compiler objects with the cc, cxx, f77, fc paths and the @@ -273,7 +277,9 @@ class Compiler(object): if not cls.PrgEnv_compiler: tty.die('Must supply PrgEnv_compiler with PrgEnv') - output = _shell('module avail %s' % cls.PrgEnv_compiler) +# output = _shell('module avail %s' % cls.PrgEnv_compiler) + modulecmd = which('modulecmd') + modulecmd matches = re.findall(r'(%s)/([^\s(]*)' % cls.PrgEnv_compiler, output) for name, version in matches: |