Renamed 'deferred' to 'defer' + don't use it as a decorator
This commit is contained in:
parent
dce6851d37
commit
675f944a3a
@ -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.
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user