Beginning attemps to fix concretization method to account for the new tuple architecture

This commit is contained in:
Mario Melara 2016-02-16 15:22:23 -08:00
parent 19dca4bcc9
commit 31ab238306

View file

@ -210,55 +210,74 @@ def concretize_version(self, spec):
return True # Things changed return True # Things changed
def _concretize_platform(self, arch, platform):
if issubclass(arch.platform.__class__, spack.architecture.Platform):
return True
else:
arch.platform = platform
def _concretize_operating_system(self, arch, platform): def _concretize_operating_system(self, arch, platform):
""" Future method for concretizing operating system """ """ Future method for concretizing operating system """
if isinstance(arch.arch_os, spack.architecture.OperatingSystem): if isinstance(arch.platform_os, spack.architecture.OperatingSystem):
return False return False
else: else:
arch.arch_os = platform.operating_system('default') arch.arch_os = platform.operating_system('default_os')
return True return True
def _concretize_arch_target(self, arch, platform): def _concretize_target(self, arch, platform):
if isinstance(arch.target, spack.architecture.Target): if isinstance(arch.target, spack.architecture.Target):
return False return False
else: else:
arch.target = platform.target('default') arch.target = platform.target('default')
return True return True
def concretize_target(self, spec): def concretize_architecture(self, spec):
"""If the spec already has an target and it is a an target type, """If the spec is empty provide the defaults of the platform. If the
return. Otherwise, if it has a target that is a string type, generate a architecture is not a basestring, then check if either the platform,
target based on that type. If it has no target and the root of the target or operating system are concretized. If any of the fields are
DAG has an target, then use that. Otherwise, take the system's default changed then return True. If everything is concretized (i.e the
target. architecture attribute is a namedtuple of classes) then return False.
If the target is a string type, then convert the string into a
concretized architecture. If it has no architecture and the root of the
DAG has an architecture, then use the root otherwise use the defaults
on the platform.
""" """
platform = spack.architecture.sys_type()
if spec.target is None: platform = spack.architecture.sys_type()
import ipdb;ipdb.set_trace()
if spec.architecture is None:
# Create an empty tuple # Create an empty tuple
Arch = collections.namedtuple("Arch", "arch_os target") Arch = spack.architecture.Arch
spec.target = Arch(arch_os=platform.operating_system('default'), # Set the architecture to all defaults
target=platform.target('default')) spec.architecture = Arch(platform=platform,
return True platform_os=platform.operating_system('default_os'),
# If there is a target and it is a tuple and has both filled return target=platform.target('default'))
# False return True
if not isinstance(spec.target, basestring): #If there is a target and it is a tuple and has both filled return
return any((self._concretize_operating_system(spec.target, platform), #False
self._concretize_arch_target(spec.target, platform))) if not isinstance(spec.architecture, basestring):
return any((
self._concretize_platform(spec.architecture, platform),
self._concretize_operating_system(spec.architecture, platform),
self._concretize_arch_target(spec.architecture, platform)))
else: else:
spec.add_target_from_string(spec.target) spec.add_target_from_string(spec.target)
if spec.root.target and \ # Does not look pretty at all!!!
not isinstance(spec.root.target, basestring): if spec.root.architecture and \
bool_flag = any( not isinstance(spec.root.architecture, basestring):
(self._concretize_operating_system(spec.root.target, platform), bool_flag = any((
self._concretize_arch_target(spec.root.target, platform))) self._concretize_platform(spec.root.architecture, platform),
spec.target =spec.root.target self._concretize_operating_system(spec.root.architecture,
platform),
self._concretize_target(spec.root.target, platform)))
spec.architecture =spec.root.architecture
return bool_flag return bool_flag
else: else:
spec.add_target_from_string(spec.root.target) spec.add_architecture_from_string(spec.root.architecture)
return True
# if there is no target specified used the defaults # if there is no target specified used the defaults