Refactored architecture class. Now it will automagically create a dict upon instantiation.
This commit is contained in:
parent
3ba2842b53
commit
ca3cc5b23e
1 changed files with 4 additions and 5 deletions
|
@ -49,7 +49,6 @@ class Architecture(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, front=None, back=None):
|
def __init__(self, front=None, back=None):
|
||||||
|
|
||||||
""" Constructor for the architecture class. Should return a dictionary of name (grabbed from uname)
|
""" Constructor for the architecture class. Should return a dictionary of name (grabbed from uname)
|
||||||
and a strategy for searching for that architecture's compiler.
|
and a strategy for searching for that architecture's compiler.
|
||||||
The target passed to it should be a dictionary of names and strategies.
|
The target passed to it should be a dictionary of names and strategies.
|
||||||
|
@ -63,6 +62,7 @@ def add_compiler_strategy(names):
|
||||||
This will tell Spack whether to look in the $PATH
|
This will tell Spack whether to look in the $PATH
|
||||||
or $MODULES location for compilers
|
or $MODULES location for compilers
|
||||||
"""
|
"""
|
||||||
|
#TODO: Look for other strategies
|
||||||
d = {}
|
d = {}
|
||||||
for n in names:
|
for n in names:
|
||||||
if n:
|
if n:
|
||||||
|
@ -76,21 +76,20 @@ def add_compiler_strategy(names):
|
||||||
|
|
||||||
self.arch_dict = add_compiler_strategy(names)
|
self.arch_dict = add_compiler_strategy(names)
|
||||||
|
|
||||||
def get_sys_type_from_spack_globals(): #TODO: Figure out how this function works
|
def get_sys_type_from_spack_globals():
|
||||||
"""Return the SYS_TYPE from spack globals, or None if it isn't set."""
|
"""Return the SYS_TYPE from spack globals, or None if it isn't set."""
|
||||||
if not hasattr(spack, "sys_type"):
|
if not hasattr(spack, "sys_type"):
|
||||||
return None
|
return None
|
||||||
elif hasattr(spack.sys_type, "__call__"):
|
elif hasattr(spack.sys_type, "__call__"):
|
||||||
return Architecture(spack.sys_type())
|
return Architecture(spack.sys_type()) #If in __init__.py there is a sys_type() then call that
|
||||||
else:
|
else:
|
||||||
return Architecture(spack.sys_type)
|
return Architecture(spack.sys_type) # Else use the attributed which defaults to None
|
||||||
|
|
||||||
# This is livermore dependent. Hard coded for livermore
|
# This is livermore dependent. Hard coded for livermore
|
||||||
#def get_sys_type_from_environment():
|
#def get_sys_type_from_environment():
|
||||||
# """Return $SYS_TYPE or None if it's not defined."""
|
# """Return $SYS_TYPE or None if it's not defined."""
|
||||||
# return os.environ.get('SYS_TYPE')
|
# return os.environ.get('SYS_TYPE')
|
||||||
|
|
||||||
|
|
||||||
def get_mac_sys_type():
|
def get_mac_sys_type():
|
||||||
"""Return a Mac OS SYS_TYPE or None if this isn't a mac.
|
"""Return a Mac OS SYS_TYPE or None if this isn't a mac.
|
||||||
Front-end config
|
Front-end config
|
||||||
|
|
Loading…
Reference in a new issue