diff --git a/lib/spack/llnl/util/multiproc.py b/lib/spack/llnl/util/multiproc.py index dc778b6f76e..04f1373aaf0 100644 --- a/lib/spack/llnl/util/multiproc.py +++ b/lib/spack/llnl/util/multiproc.py @@ -14,7 +14,7 @@ __all__ = ['Barrier'] -def deferred(func): +def defer(func): """Package a function call into something that can be invoked at a later moment. diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py index 43f807cb14c..9e0fcb69a47 100644 --- a/lib/spack/spack/compiler.py +++ b/lib/spack/spack/compiler.py @@ -302,7 +302,8 @@ def search_compiler_commands(cls, operating_system, *search_paths): _NameVariation(*match.groups()), language) ) commands.append( - detect_version_command(callback, full_path) + llnl.util.multiproc.defer(detect_version) + (callback, full_path) ) # Reverse it here so that the dict creation (last insert wins) @@ -351,8 +352,7 @@ def __hash__(self): _NameVariation = collections.namedtuple('_NameVariation', ['prefix', 'suffix']) -@llnl.util.multiproc.deferred -def detect_version_command(callback, path): +def detect_version(callback, path): """Detects the version of a compiler at a given path. Args: diff --git a/lib/spack/spack/test/compilers.py b/lib/spack/spack/test/compilers.py index 2d3d497f248..ae39382de82 100644 --- a/lib/spack/spack/test/compilers.py +++ b/lib/spack/spack/test/compilers.py @@ -23,7 +23,7 @@ import spack.compilers.xl_r import spack.compilers.fj -from spack.compiler import detect_version_command, Compiler +from spack.compiler import detect_version, Compiler def test_get_compiler_duplicates(config): @@ -46,14 +46,14 @@ def test_all_compilers(config): def test_version_detection_is_empty(): - command = detect_version_command(lambda x: None, path='/usr/bin/gcc') + version = detect_version(lambda x: None, path='/usr/bin/gcc') expected = (None, "Couldn't get version for compiler /usr/bin/gcc") - assert command() == expected + assert version == expected def test_version_detection_is_successful(): - command = detect_version_command(lambda x: '4.9', path='/usr/bin/gcc') - assert command() == (('4.9', '/usr/bin/gcc'), None) + version = detect_version(lambda x: '4.9', path='/usr/bin/gcc') + assert version == (('4.9', '/usr/bin/gcc'), None) def test_compiler_flags_from_config_are_grouped():