From 5347f460b4f2ce8ad64f6ec225779c2a2f944ad4 Mon Sep 17 00:00:00 2001 From: Gregory Becker Date: Wed, 11 Nov 2015 10:31:37 -0800 Subject: [PATCH] adding module find to find command --- lib/spack/spack/compiler.py | 12 +++++++++--- 1 file 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 @@ def check(exe): self.fc = check(fc) self.spec = cspec - self.modules = modules.split() + self.modules = modules @@ -216,6 +216,10 @@ def check(key): @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 @@ def find_in_modules(cls): 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: