diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py index dac3a45b79..45a9dac8ba 100644 --- a/lib/spack/spack/architecture.py +++ b/lib/spack/spack/architecture.py @@ -203,8 +203,8 @@ class Arch(namedtuple("Arch", "platform platform_os target")): __slots__ = () def __str__(self): - return (self.platform.name +"-"+ - self.platform_os.name + "-" + self.target.name) + return (str(self.platform) +"-"+ + str(self.platform_os) + "-" + str(self.target) ) def _cmp_key(self): return (self.platform, self.platform_os, self.target) @@ -246,14 +246,14 @@ def to_dict(arch): return d -def _platform_from_dict(platform): - """Creates all the platform class module names into a dictionary of - name : key-value pairs. From there we can construct the - platform subclass - """ - platform_list = all_platforms() - platform_names = {plat.__name__.lower():plat for plat in platform_list} - return platform_names[platform['name']]() +#def _platform_from_dict(platform): +# """Creates all the platform class module names into a dictionary of +# name : key-value pairs. From there we can construct the +# platform subclass +# """ +# platform_list = all_platforms() +# platform_names = {plat.__name__.lower():plat for plat in platform_list} +# return platform_names[platform['name']]() def _target_from_dict(target_dict): @@ -288,7 +288,7 @@ def arch_from_dict(d): platform_os_dict = d['platform_os'] target_dict = d['target'] - platform = _platform_from_dict(platform_dict) + platform = d['platform'] platform_os = _operating_system_from_dict(platform_os_dict, platform) target = _target_from_dict(target_dict) diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py index 60efba59c2..afb12838e8 100644 --- a/lib/spack/spack/concretize.py +++ b/lib/spack/spack/concretize.py @@ -217,14 +217,14 @@ def _concretize_platform(self, arch, platform): arch.platform = platform return True - def _concretize_operating_system(self, arch, platform): + def _concretize_operating_system(self, spec, platform): if spec.architecture.platform_os is not None: if isinstance(spec.architecture.platform_os,spack.architecture.OperatingSystem): return False else: spec.add_operating_system_from_string(spec.architecture.platform_os) return True #changed - if spec.root.architecture.platform_os: + if spec.root.architecture and spec.root.architecture.platform_os: if isinstance(spec.root.architecture.platform_os,spack.architecture.OperatingSystem): spec.architecture.platform_os = spec.root.architecture.platform_os else: @@ -243,22 +243,22 @@ def _concretize_operating_system(self, arch, platform): # return True - def _concretize_target(self, arch, platform): - if spec.target is not None: - if isinstance(spec.target,spack.architecture.Target): + def _concretize_target(self, spec, platform): + if spec.architecture.target is not None: + if isinstance(spec.architecture.target,spack.architecture.Target): return False else: - spec.add_target_from_string(spec.target) + spec.add_target_from_string(spec.architecture.target) return True #changed - if spec.root.target: - if isinstance(spec.root.target,spack.architecture.Target): - spec.target = spec.root.target + if spec.root.architecture and spec.root.architecture.target: + if isinstance(spec.root.architecture.target,spack.architecture.Target): + spec.architecture.target = spec.root.architecture.target else: - spec.add_target_from_string(spec.root.target) + spec.add_target_from_string(spec.root.architecture.target) else: platform = spack.architecture.sys_type() - spec.target = platform.target('default') + spec.architecture.target = platform.target('default') return True #changed @@ -283,22 +283,20 @@ def concretize_architecture(self, spec): platform = spack.architecture.sys_type() if spec.architecture is None: - # Create an empty tuple - Arch = spack.architecture.Arch # Set the architecture to all defaults - spec.architecture = Arch(platform=platform, platform_os=None, + spec.architecture = spack.architecture.Arch(platform=platform, platform_os=None, target=None) return True #If there is a target and it is a tuple and has both filled return #False # if isinstance(spec.architecture, basestring): # spec.split_architecture_string(spec.architecture) - + print spec.architecture ret = any(( self._concretize_platform(spec.architecture, platform), - self._concretize_operating_system(spec.architecture, platform), - self._concretize_target(spec.architecture, platform))) + self._concretize_operating_system(spec, platform), + self._concretize_target(spec, platform))) # Does not look pretty at all!!! diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 06accc514b..5cb94907d3 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -462,11 +462,12 @@ def _set_architecture(self, architecture): if self.architecture: raise DuplicateArchitectureError( "Spec for '%s' cannot have two architectures." % self.name) platform = spack.architecture.sys_type() + print architecture if '-' in architecture: os, target = architecture.split('-') else: - os = architecture - target = None + os = None + target = architecture self.architecture = spack.architecture.Arch(platform, os, target) @@ -1257,17 +1258,17 @@ def _is_valid_os(self, os_string, platform): return True return False - def add_target_from_string(self, arch): - if arch.target is None: - return arch.platform.target('default_target') + def add_target_from_string(self, target): + if target is None: + self.architecture.target = self.architecture.platform.target('default_target') else: - return arch.platform.target(arch.target) + self.architecture.target = self.architecture.platform.target(target) - def add_operating_system_from_string(self, arch): - if arch.platform_os is None: - return arch.platform.operating_system('default_os') + def add_operating_system_from_string(self, os): + if os is None: + self.architecture.platform_os = self.architecture.platform.operating_system('default_os') else: - return arch.platform.operating_system(arch.platform_os) + self.architecture.platform_os = self.architecture.platform.operating_system(os) #def add_architecture_from_string(self, arch): # """ The user is able to provide a architecture string of the form