summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/__init__.py2
-rw-r--r--lib/spack/spack/abi.py8
-rw-r--r--lib/spack/spack/architecture.py62
-rw-r--r--lib/spack/spack/build_environment.py4
-rw-r--r--lib/spack/spack/cmd/find.py10
-rw-r--r--lib/spack/spack/concretize.py40
-rw-r--r--lib/spack/spack/config.py42
-rw-r--r--lib/spack/spack/directory_layout.py4
-rw-r--r--lib/spack/spack/modules.py4
-rw-r--r--lib/spack/spack/package.py2
-rw-r--r--lib/spack/spack/platforms/__init__.py (renamed from lib/spack/spack/architectures/__init__.py)0
-rw-r--r--lib/spack/spack/platforms/bgq.py (renamed from lib/spack/spack/architectures/bgq.py)4
-rw-r--r--lib/spack/spack/platforms/cray.py (renamed from lib/spack/spack/architectures/cray.py)4
-rw-r--r--lib/spack/spack/platforms/darwin.py (renamed from lib/spack/spack/architectures/darwin.py)10
-rw-r--r--lib/spack/spack/platforms/linux.py (renamed from lib/spack/spack/architectures/linux.py)10
-rw-r--r--lib/spack/spack/preferred_packages.py10
-rw-r--r--lib/spack/spack/spec.py108
-rw-r--r--lib/spack/spack/test/architecture.py23
-rw-r--r--lib/spack/spack/test/concretize.py4
-rw-r--r--lib/spack/spack/test/multimethod.py12
-rw-r--r--lib/spack/spack/test/spec_dag.py4
-rw-r--r--lib/spack/spack/test/spec_semantics.py4
-rw-r--r--var/spack/mock_packages/multimethod/package.py10
23 files changed, 191 insertions, 190 deletions
diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index b2ff2c692b..e1ef094f17 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -37,7 +37,7 @@ etc_path = join_path(prefix, "etc")
lib_path = join_path(prefix, "lib", "spack")
build_env_path = join_path(lib_path, "env")
module_path = join_path(lib_path, "spack")
-arch_path = join_path(module_path, 'architectures')
+platform_path = join_path(module_path, 'platforms')
compilers_path = join_path(module_path, "compilers")
test_path = join_path(module_path, "test")
hooks_path = join_path(module_path, "hooks")
diff --git a/lib/spack/spack/abi.py b/lib/spack/spack/abi.py
index f0a997703c..1dd49d6b2c 100644
--- a/lib/spack/spack/abi.py
+++ b/lib/spack/spack/abi.py
@@ -34,9 +34,9 @@ class ABI(object):
"""This class provides methods to test ABI compatibility between specs.
The current implementation is rather rough and could be improved."""
- def architecture_compatible(self, parent, child):
- """Returns true iff the parent and child specs have ABI compatible architectures."""
- return not parent.architecture or not child.architecture or parent.architecture == child.architecture
+ def target_compatible(self, parent, child):
+ """Returns true iff the parent and child specs have ABI compatible targets."""
+ return not parent.target or not child.target or parent.target == child.target
@memoized
@@ -123,6 +123,6 @@ class ABI(object):
def compatible(self, parent, child, **kwargs):
"""Returns true iff a parent and child spec are ABI compatible"""
loosematch = kwargs.get('loose', False)
- return self.architecture_compatible(parent, child) and \
+ return self.target_compatible(parent, child) and \
self.compiler_compatible(parent, child, loose=loosematch)
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py
index aaea7c81ac..a269767fab 100644
--- a/lib/spack/spack/architecture.py
+++ b/lib/spack/spack/architecture.py
@@ -51,8 +51,8 @@ class NoSysTypeError(serr.SpackError):
class Target(object):
""" Target is the processor of the host machine. The host machine may have different front-end
and back-end targets, especially if it is a Cray machine. The target will have a name and
- also the module_name (e.g craype-compiler). Targets will also recognize which architecture
- they came from using the set_architecture method. Targets will have compiler finding strategies
+ also the module_name (e.g craype-compiler). Targets will also recognize which platform
+ they came from using the set_platform method. Targets will have compiler finding strategies
"""
def __init__(self, name, compiler_strategy, module_name=None):
@@ -60,17 +60,17 @@ class Target(object):
self.compiler_strategy = compiler_strategy
self.module_name = module_name # craype-ivybridge
- # Sets only the architecture name to avoid recursiveness
- def set_architecture(self, architecture):
- self.architecture_name = architecture.name
+ # Sets only the platform name to avoid recursiveness
+ def set_platform(self, platform):
+ self.platform_name = platform.name
def to_dict(self):
d = {}
d['name'] = self.name
d['compiler_strategy'] = self.compiler_strategy
d['module_name'] = self.module_name
- if self.architecture_name:
- d['architecture'] = self.architecture_name
+ if self.platform_name:
+ d['platform'] = self.platform_name
return d
@staticmethod
@@ -81,8 +81,8 @@ class Target(object):
target.name = d['name']
target.compiler_strategy = d['compiler_strategy']
target.module_name = d['module_name']
- if 'architecture' in d:
- target.architecture_name = d['architecture']
+ if 'platform' in d:
+ target.platform_name = d['platform']
return target
@@ -96,13 +96,13 @@ class Target(object):
return self.name
@key_ordering
-class Architecture(object):
- """ Abstract class that each type of Architecture will subclass.
+class Platform(object):
+ """ Abstract class that each type of Platform will subclass.
Will return a instance of it once it
is returned
"""
- priority = None # Subclass needs to set this number. This controls order in which arch is detected.
+ priority = None # Subclass needs to set this number. This controls order in which platform is detected.
front_end = None
back_end = None
default = None # The default back end target. On cray ivybridge
@@ -112,12 +112,12 @@ class Architecture(object):
self.name = name
def add_target(self, name, target):
- """Used by the architecture specific subclass to list available targets. Raises an error
- if the architecture specifies a name that is reserved by spack as an alias.
+ """Used by the platform specific subclass to list available targets. Raises an error
+ if the platform specifies a name that is reserved by spack as an alias.
"""
if name in ['front_end', 'fe', 'back_end', 'be', 'default']:
raise ValueError("%s is a spack reserved alias and cannot be the name of a target" % name)
- target.set_architecture(self)
+ target.set_platform(self)
self.targets[name] = target
def target(self, name):
@@ -137,7 +137,7 @@ class Architecture(object):
@classmethod
def detect(self):
""" Subclass is responsible for implementing this method.
- Returns True if the architecture detects if it is the current architecture
+ Returns True if the Platform class detects that it is the current platform
and False if it's not.
"""
raise NotImplementedError()
@@ -182,18 +182,18 @@ def get_sys_type_from_uname():
Front-end config
"""
try:
- arch_proc = subprocess.Popen(['uname', '-i'], stdout = subprocess.PIPE)
- arch, _ = arch_proc.communicate()
- return arch.strip()
+ platform_proc = subprocess.Popen(['uname', '-i'], stdout = subprocess.PIPE)
+ platform, _ = platform_proc.communicate()
+ return platform.strip()
except:
return None
@memoized
-def all_architectures():
+def all_platforms():
modules = []
- for name in list_modules(spack.arch_path):
- mod_name = 'spack.architectures' + name
- path = join_path(spack.arch_path, name) + ".py"
+ for name in list_modules(spack.platform_path):
+ mod_name = 'spack.platformss' + name
+ path = join_path(spack.platform_path, name) + ".py"
mod = imp.load_source(mod_name, path)
class_name = mod_to_class(name)
if not hasattr(mod, class_name):
@@ -208,16 +208,16 @@ def all_architectures():
@memoized
def sys_type():
- """ Gather a list of all available subclasses of architectures.
+ """ Gather a list of all available subclasses of platforms.
Sorts the list according to their priority looking. Priority is
- an arbitrarily set number. Detects arch either using uname or
+ an arbitrarily set number. Detects platform either using uname or
a file path (/opt/cray...)
"""
- # Try to create an architecture object using the config file FIRST
- architecture_list = all_architectures()
- architecture_list.sort(key = lambda a: a.priority)
+ # Try to create a Platform object using the config file FIRST
+ platform_list = all_platforms()
+ platform_list.sort(key = lambda a: a.priority)
- for arch in architecture_list:
- if arch.detect():
- return arch()
+ for platform in platform_list:
+ if platform.detect():
+ return platform()
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index fc71ae0331..d849b4b56c 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -226,8 +226,8 @@ def set_build_environment_variables(pkg):
pkg_config_dirs.append(pcdir)
path_put_first("PKG_CONFIG_PATH", pkg_config_dirs)
- if pkg.spec.architecture.module_name:
- load_module(pkg.spec.architecture.module_name)
+ if pkg.spec.target.module_name:
+ load_module(pkg.spec.target.module_name)
def set_module_variables_for_package(pkg):
"""Populate the module scope of install() with some useful functions.
diff --git a/lib/spack/spack/cmd/find.py b/lib/spack/spack/cmd/find.py
index 3c993990b1..7ea16bf09f 100644
--- a/lib/spack/spack/cmd/find.py
+++ b/lib/spack/spack/cmd/find.py
@@ -72,19 +72,19 @@ def display_specs(specs, **kwargs):
hashes = True
hlen = None
- # Make a dict with specs keyed by architecture and compiler.
- index = index_by(specs, ('architecture', 'compiler'))
+ # Make a dict with specs keyed by target and compiler.
+ index = index_by(specs, ('target', 'compiler'))
# Traverse the index and print out each package
- for i, (architecture, compiler) in enumerate(sorted(index)):
+ for i, (target, compiler) in enumerate(sorted(index)):
if i > 0: print
header = "%s{%s} / %s{%s}" % (
- spack.spec.architecture_color, architecture,
+ spack.spec.target_color, target,
spack.spec.compiler_color, compiler)
tty.hline(colorize(header), char='-')
- specs = index[(architecture,compiler)]
+ specs = index[(target,compiler)]
specs.sort()
abbreviated = [s.format('$_$@$+', color=True) for s in specs]
diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py
index 854db949e3..fcd23a6055 100644
--- a/lib/spack/spack/concretize.py
+++ b/lib/spack/spack/concretize.py
@@ -208,30 +208,30 @@ class DefaultConcretizer(object):
return True # Things changed
- def concretize_architecture(self, spec):
- """If the spec already has an architecture and it is a an architecture type,
- return. Otherwise, if it has an architecture that is a string type, generate an
- architecture based on that type. If it has no architecture and the root of the
- DAG has an architecture, then use that. Otherwise, take the system's default
- architecture.
+ def concretize_target(self, spec):
+ """If the spec already has an target and it is a an target type,
+ return. Otherwise, if it has a target that is a string type, generate a
+ target based on that type. If it has no target and the root of the
+ DAG has an target, then use that. Otherwise, take the system's default
+ target.
"""
- if spec.architecture is not None:
- if isinstance(spec.architecture,spack.architecture.Target):
+ if spec.target is not None:
+ if isinstance(spec.target,spack.architecture.Target):
return False
else:
- arch = spack.architecture.sys_type()
- spec.architecture = arch.target(spec.architecture)
+ platform = spack.architecture.sys_type()
+ spec.target = platform.target(spec.target)
return True #changed
- if spec.root.architecture:
- if isinstance(spec.root.architecture,spack.architecture.Target):
- spec.architecture = spec.root.architecture
+ if spec.root.target:
+ if isinstance(spec.root.target,spack.architecture.Target):
+ spec.target = spec.root.target
else:
- arch = spack.architecture.sys_type()
- spec.architecture = arch.target(spec.root.architecture)
+ platform = spack.architecture.sys_type()
+ spec.target = platform.target(spec.root.target)
else:
- arch = spack.architecture.sys_type()
- spec.architecture = arch.target('default')
+ platform = spack.architecture.sys_type()
+ spec.target = platform.target('default')
return True #changed
@@ -260,8 +260,8 @@ class DefaultConcretizer(object):
build with the compiler that will be used by libraries that
link to this one, to maximize compatibility.
"""
- # Pass on concretizing the compiler if the architecture is not yet determined
- if not spec.architecture:
+ # Pass on concretizing the compiler if the target is not yet determined
+ if not spec.target:
#Although this usually means changed, this means awaiting other changes
return True
@@ -305,7 +305,7 @@ class DefaultConcretizer(object):
# copy concrete version into other_compiler
index = len(matches)-1
- while not _proper_compiler_style(matches[index], spec.architecture):
+ while not _proper_compiler_style(matches[index], spec.target):
index -= 1
if index == 0:
raise NoValidVersionError(spec)
diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py
index 6e11cfa475..0622606a4f 100644
--- a/lib/spack/spack/config.py
+++ b/lib/spack/spack/config.py
@@ -129,7 +129,7 @@ _ConfigCategory('packages', 'packages.yaml', True)
config_scopes = [('site', os.path.join(spack.etc_path, 'spack')),
('user', os.path.expanduser('~/.spack'))]
-_compiler_by_arch = {}
+_compiler_by_platform = {}
_read_config_file_result = {}
def _read_config_file(filename):
"""Read a given YAML configuration file"""
@@ -156,7 +156,7 @@ def clear_config_caches():
s.files_read_from = []
s.result_dict = {}
spack.config._read_config_file_result = {}
- spack.config._compiler_by_arch = {}
+ spack.config._compiler_by_platform = {}
spack.compilers._cached_default_compiler = None
@@ -213,27 +213,27 @@ def get_config(category_name):
return category.result_dict
-def get_compilers_config(arch=None):
+def get_compilers_config(platform=None):
"""Get the compiler configuration from config files for the given
- architecture. Strips off the architecture component of the
+ platform. Strips off the platform component of the
configuration"""
- global _compiler_by_arch
- if not arch:
- arch = str(spack.architecture.sys_type())
- if arch in _compiler_by_arch:
- return _compiler_by_arch[arch]
+ global _compiler_by_platform
+ if not platform:
+ platform = str(spack.architecture.sys_type())
+ if platform in _compiler_by_platform:
+ return _compiler_by_platform[platform]
cc_config = get_config('compilers')
- if arch in cc_config and 'all' in cc_config:
- arch_compiler = dict(cc_config[arch])
- _compiler_by_arch[arch] = _merge_dict(arch_compiler, cc_config['all'])
- elif arch in cc_config:
- _compiler_by_arch[arch] = cc_config[arch]
+ if platform in cc_config and 'all' in cc_config:
+ platform_compiler = dict(cc_config[platform])
+ _compiler_by_platform[platform] = _merge_dict(platform_compiler, cc_config['all'])
+ elif platform in cc_config:
+ _compiler_by_platform[platform] = cc_config[platform]
elif 'all' in cc_config:
- _compiler_by_arch[arch] = cc_config['all']
+ _compiler_by_platform[platform] = cc_config['all']
else:
- _compiler_by_arch[arch] = {}
- return _compiler_by_arch[arch]
+ _compiler_by_platform[platform] = {}
+ return _compiler_by_platform[platform]
def get_mirror_config():
@@ -371,11 +371,11 @@ def add_to_mirror_config(addition_dict, scope=None):
add_to_config('mirrors', addition_dict, scope)
-def add_to_compiler_config(addition_dict, scope=None, arch=None):
+def add_to_compiler_config(addition_dict, scope=None, platform=None):
"""Add compilers to the configuration files"""
- if not arch:
- arch = spack.architecture.sys_type()
- add_to_config('compilers', { str(arch) : addition_dict }, scope)
+ if not platform:
+ platform = spack.architecture.sys_type()
+ add_to_config('compilers', { str(platform) : addition_dict }, scope)
clear_config_caches()
diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py
index 83e6eb566a..da3441fa13 100644
--- a/lib/spack/spack/directory_layout.py
+++ b/lib/spack/spack/directory_layout.py
@@ -156,7 +156,7 @@ class DirectoryLayout(object):
class YamlDirectoryLayout(DirectoryLayout):
"""Lays out installation directories like this::
<install root>/
- <architecture>/
+ <target>/
<compiler>-<compiler version>/
<name>-<version>-<variants>-<hash>
@@ -201,7 +201,7 @@ class YamlDirectoryLayout(DirectoryLayout):
spec.dag_hash(self.hash_len))
path = join_path(
- spec.architecture,
+ spec.target,
"%s-%s" % (spec.compiler.name, spec.compiler.version),
dir_name)
diff --git a/lib/spack/spack/modules.py b/lib/spack/spack/modules.py
index 56a61adefb..f84ac75c77 100644
--- a/lib/spack/spack/modules.py
+++ b/lib/spack/spack/modules.py
@@ -193,7 +193,7 @@ class Dotkit(EnvModule):
@property
def file_name(self):
- return join_path(Dotkit.path, self.spec.architecture,
+ return join_path(Dotkit.path, self.spec.target,
self.spec.format('$_$@$%@$+$#.dk'))
@property
@@ -230,7 +230,7 @@ class TclModule(EnvModule):
@property
def file_name(self):
- return join_path(TclModule.path, self.spec.architecture, self.use_name)
+ return join_path(TclModule.path, self.spec.target, self.use_name)
@property
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index e0097fa88d..1148e4ac3d 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -592,7 +592,7 @@ class Package(object):
"""Get the spack.compiler.Compiler object used to build this package."""
if not self.spec.concrete:
raise ValueError("Can only get a compiler for a concrete package.")
- return spack.compilers.compiler_for_spec(self.spec.compiler, self.spec.architecture)
+ return spack.compilers.compiler_for_spec(self.spec.compiler, self.spec.target)
def url_version(self, version):
diff --git a/lib/spack/spack/architectures/__init__.py b/lib/spack/spack/platforms/__init__.py
index e69de29bb2..e69de29bb2 100644
--- a/lib/spack/spack/architectures/__init__.py
+++ b/lib/spack/spack/platforms/__init__.py
diff --git a/lib/spack/spack/architectures/bgq.py b/lib/spack/spack/platforms/bgq.py
index 3ac5a59546..988e67023c 100644
--- a/lib/spack/spack/architectures/bgq.py
+++ b/lib/spack/spack/platforms/bgq.py
@@ -1,8 +1,8 @@
import os
-from spack.architecture import Architecture, Target
+from spack.architecture import Platform, Target
-class Bgq(Architecture):
+class Bgq(Platform):
priority = 30
front_end = 'power7'
back_end = 'powerpc'
diff --git a/lib/spack/spack/architectures/cray.py b/lib/spack/spack/platforms/cray.py
index f109b48867..815a9aea98 100644
--- a/lib/spack/spack/architectures/cray.py
+++ b/lib/spack/spack/platforms/cray.py
@@ -1,8 +1,8 @@
import os
-from spack.architecture import Architecture, Target
+from spack.architecture import Platform, Target
-class Cray(Architecture):
+class Cray(Platform):
priority = 20
front_end = 'sandybridge'
back_end = 'ivybridge'
diff --git a/lib/spack/spack/architectures/darwin.py b/lib/spack/spack/platforms/darwin.py
index 30fbde39bb..52284826b1 100644
--- a/lib/spack/spack/architectures/darwin.py
+++ b/lib/spack/spack/platforms/darwin.py
@@ -1,7 +1,7 @@
import subprocess
-from spack.architecture import Architecture, Target
+from spack.architecture import Platform, Target
-class Darwin(Architecture):
+class Darwin(Platform):
priority = 89
front_end = 'x86_64'
back_end = 'x86_64'
@@ -13,6 +13,6 @@ class Darwin(Architecture):
@classmethod
def detect(self):
- arch = subprocess.Popen(['uname', '-a'], stdout = subprocess.PIPE)
- arch, _ = arch.communicate()
- return 'darwin' in arch.strip().lower()
+ platform = subprocess.Popen(['uname', '-a'], stdout = subprocess.PIPE)
+ platform, _ = platform.communicate()
+ return 'darwin' in platform.strip().lower()
diff --git a/lib/spack/spack/architectures/linux.py b/lib/spack/spack/platforms/linux.py
index bb3089ebf6..7f94d80c34 100644
--- a/lib/spack/spack/architectures/linux.py
+++ b/lib/spack/spack/platforms/linux.py
@@ -1,7 +1,7 @@
import subprocess
-from spack.architecture import Architecture, Target
+from spack.architecture import Platform, Target
-class Linux(Architecture):
+class Linux(Platform):
priority = 90
front_end = 'x86_64'
back_end = 'x86_64'
@@ -13,6 +13,6 @@ class Linux(Architecture):
@classmethod
def detect(self):
- arch = subprocess.Popen(['uname', '-a'], stdout = subprocess.PIPE)
- arch, _ = arch.communicate()
- return 'linux' in arch.strip().lower()
+ platform = subprocess.Popen(['uname', '-a'], stdout = subprocess.PIPE)
+ platform, _ = platform.communicate()
+ return 'linux' in platform.strip().lower()
diff --git a/lib/spack/spack/preferred_packages.py b/lib/spack/spack/preferred_packages.py
index bc2a4ac234..993683a62f 100644
--- a/lib/spack/spack/preferred_packages.py
+++ b/lib/spack/spack/preferred_packages.py
@@ -163,11 +163,11 @@ class PreferredPackages(object):
return self._component_compare(pkgname, 'variant', a, b, False, None)
- def architecture_compare(self, pkgname, a, b):
- """Return less-than-0, 0, or greater than 0 if architecture a of pkgname is
- respecively less-than, equal-to, or greater-than architecture b of pkgname.
- One architecture is less-than another if it is preferred over the other."""
- return self._component_compare(pkgname, 'architecture', a, b, False, None)
+ def target_compare(self, pkgname, a, b):
+ """Return less-than-0, 0, or greater than 0 if target a of pkgname is
+ respecively less-than, equal-to, or greater-than target b of pkgname.
+ One target is less-than another if it is preferred over the other."""
+ return self._component_compare(pkgname, 'target', a, b, False, None)
def compiler_compare(self, pkgname, a, b):
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 126ffc4f95..9e011bfb9f 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -63,7 +63,7 @@ line is a spec for a particular installation of the mpileaks package.
if it comes immediately after the compiler name. Otherwise it will be
associated with the current package spec.
-6. The architecture to build with. This is needed on machines where
+6. The target to build with. This is needed on machines where
cross-compilation is required
Here is the EBNF grammar for a spec::
@@ -72,9 +72,9 @@ Here is the EBNF grammar for a spec::
dep_list = { ^ spec }
spec = id [ options ]
options = { @version-list | +variant | -variant | ~variant |
- %compiler | =architecture }
+ %compiler | =target }
variant = id
- architecture = id
+ target = id
compiler = id [ version-list ]
version-list = version [ { , version } ]
version = id | id: | :id | id:id
@@ -119,7 +119,7 @@ identifier_re = r'\w[\w-]*'
# Convenient names for color formats so that other things can use them
compiler_color = '@g'
version_color = '@c'
-architecture_color = '@m'
+target_color = '@m'
enabled_variant_color = '@B'
disabled_variant_color = '@r'
dependency_color = '@.'
@@ -130,7 +130,7 @@ hash_color = '@K'
See spack.color for descriptions of the color codes. """
color_formats = {'%' : compiler_color,
'@' : version_color,
- '=' : architecture_color,
+ '=' : target_color,
'+' : enabled_variant_color,
'~' : disabled_variant_color,
'^' : dependency_color,
@@ -407,7 +407,7 @@ class Spec(object):
self.name = other.name
self.dependents = other.dependents
self.versions = other.versions
- self.architecture = other.architecture
+ self.target = other.target
self.compiler = other.compiler
self.dependencies = other.dependencies
self.variants = other.variants
@@ -452,11 +452,11 @@ class Spec(object):
self.compiler = compiler
- def _set_architecture(self, architecture):
- """Called by the parser to set the architecture."""
- if self.architecture: raise DuplicateArchitectureError(
- "Spec for '%s' cannot have two architectures." % self.name)
- self.architecture = architecture
+ def _set_target(self, target):
+ """Called by the parser to set the target."""
+ if self.target: raise DuplicateTargetError(
+ "Spec for '%s' cannot have two targets." % self.name)
+ self.target = target
def _add_dependency(self, spec):
@@ -512,7 +512,7 @@ class Spec(object):
@property
def concrete(self):
"""A spec is concrete if it can describe only ONE build of a package.
- If any of the name, version, architecture, compiler,
+ If any of the name, version, target, compiler,
variants, or depdenencies are ambiguous,then it is not concrete.
"""
if self._concrete:
@@ -521,7 +521,7 @@ class Spec(object):
self._concrete = bool(not self.virtual
and self.versions.concrete
and self.variants.concrete
- and self.architecture
+ and self.target
and self.compiler and self.compiler.concrete
and self.dependencies.concrete)
return self._concrete
@@ -656,10 +656,10 @@ class Spec(object):
'dependencies' : dict((d, self.dependencies[d].dag_hash())
for d in sorted(self.dependencies))
}
- if self.architecture:
- d['arch'] = self.architecture.to_dict()
+ if self.target:
+ d['target'] = self.target.to_dict()
else:
- d['arch'] = None
+ d['target'] = None
if self.compiler:
d.update(self.compiler.to_dict())
else:
@@ -685,7 +685,7 @@ class Spec(object):
spec = Spec(name)
spec.versions = VersionList.from_dict(node)
- spec.architecture = spack.architecture.Target.from_dict(node['arch'])
+ spec.target = spack.architecture.Target.from_dict(node['target'])
if node['compiler'] is None:
spec.compiler = None
@@ -757,7 +757,7 @@ class Spec(object):
# to presets below, their constraints will all be merged, but we'll
# still need to select a concrete package later.
changed |= any(
- (spack.concretizer.concretize_architecture(self),
+ (spack.concretizer.concretize_target(self),
spack.concretizer.concretize_compiler(self),
spack.concretizer.concretize_version(self),
spack.concretizer.concretize_variants(self)))
@@ -1145,10 +1145,10 @@ class Spec(object):
raise UnsatisfiableVariantSpecError(self.variants[v],
other.variants[v])
- if self.architecture is not None and other.architecture is not None:
- if self.architecture != other.architecture:
- raise UnsatisfiableArchitectureSpecError(self.architecture,
- other.architecture)
+ if self.target is not None and other.target is not None:
+ if self.target != other.target:
+ raise UnsatisfiableTargetSpecError(self.target,
+ other.target)
changed = False
if self.compiler is not None and other.compiler is not None:
@@ -1160,9 +1160,9 @@ class Spec(object):
changed |= self.versions.intersect(other.versions)
changed |= self.variants.constrain(other.variants)
- old = self.architecture
- self.architecture = self.architecture or other.architecture
- changed |= (self.architecture != old)
+ old = self.target
+ self.target = self.target or other.target
+ changed |= (self.target != old)
if deps:
changed |= self._constrain_dependencies(other)
@@ -1273,12 +1273,12 @@ class Spec(object):
if not self.variants.satisfies(other.variants, strict=strict):
return False
- # Architecture satisfaction is currently just string equality.
+ # Target satisfaction is currently just class equality.
# If not strict, None means unconstrained.
- if self.architecture and other.architecture:
- if self.architecture != other.architecture:
+ if self.target and other.target:
+ if self.target != other.target:
return False
- elif strict and (other.architecture and not self.architecture):
+ elif strict and (other.target and not self.target):
return False
# If we need to descend into dependencies, do it, otherwise we're done.
@@ -1352,7 +1352,7 @@ class Spec(object):
changed = True
if hasattr(self, 'name'):
changed = (self.name != other.name and self.versions != other.versions and \
- self.architecture != other.architecture and self.compiler != other.compiler and \
+ self.target != other.target and self.compiler != other.compiler and \
self.variants != other.variants and self._normal != other._normal and \
self.concrete != other.concrete and self.external != other.external and \
self.external_module != other.external_module)
@@ -1360,7 +1360,7 @@ class Spec(object):
# Local node attributes get copied first.
self.name = other.name
self.versions = other.versions.copy()
- self.architecture = other.architecture
+ self.target = other.target
self.compiler = other.compiler.copy() if other.compiler else None
if kwargs.get('cleardeps', True):
self.dependents = DependencyMap()
@@ -1490,7 +1490,7 @@ class Spec(object):
def _cmp_node(self):
"""Comparison key for just *this node* and not its deps."""
return (self.name, self.versions, self.variants,
- self.architecture, self.compiler)
+ self.target, self.compiler)
def eq_node(self, other):
@@ -1524,7 +1524,7 @@ class Spec(object):
$% Compiler with '%' prefix
$%@ Compiler with '%' prefix & compiler version with '@' prefix
$+ Options
- $= Architecture with '=' prefix
+ $= Target with '=' prefix
$# 7-char prefix of DAG hash with '-' prefix
$$ $
@@ -1536,7 +1536,7 @@ class Spec(object):
${COMPILERNAME} Compiler name
${COMPILERVER} Compiler version
${OPTIONS} Options
- ${ARCHITECTURE} Architecture
+ ${TARGET} Target
${SHA1} Dependencies 8-char sha1 prefix
${SPACK_ROOT} The spack root directory
@@ -1549,7 +1549,7 @@ class Spec(object):
Anything else is copied verbatim into the output stream.
*Example:* ``$_$@$+`` translates to the name, version, and options
- of the package, but no dependencies, arch, or compiler.
+ of the package, but no dependencies, target, or compiler.
TODO: allow, e.g., $6# to customize short hash length
TODO: allow, e.g., $## for full hash.
@@ -1593,8 +1593,8 @@ class Spec(object):
if self.variants:
write(fmt % str(self.variants), c)
elif c == '=':
- if self.architecture:
- write(fmt % (c + str(self.architecture)), c)
+ if self.target:
+ write(fmt % (c + str(self.target)), c)
elif c == '#':
out.write('-' + fmt % (self.dag_hash(7)))
elif c == '$':
@@ -1641,9 +1641,9 @@ class Spec(object):
elif named_str == 'OPTIONS':
if self.variants:
write(fmt % str(self.variants), '+')
- elif named_str == 'ARCHITECTURE':
- if self.architecture:
- write(fmt % str(self.architecture), '=')
+ elif named_str == 'TARGET':
+ if self.target:
+ write(fmt % str(self.target), '=')
elif named_str == 'SHA1':
if self.dependencies:
out.write(fmt % str(self.dep_hash(8)))
@@ -1691,10 +1691,10 @@ class Spec(object):
return spack.pkgsort.variant_compare(pkgname,
self.variants, other.variants)
- #Architecture
- if self.architecture != other.architecture:
- return spack.pkgsort.architecture_compare(pkgname,
- self.architecture, other.architecture)
+ #Target
+ if self.target != other.target:
+ return spack.pkgsort.target_compare(pkgname,
+ self.target, other.target)
#Dependency is not configurable
if self.dep_hash() != other.dep_hash():
@@ -1811,7 +1811,7 @@ class SpecParser(spack.parse.Parser):
spec.name = self.token.value
spec.versions = VersionList()
spec.variants = VariantMap(spec)
- spec.architecture = None
+ spec.target = None
spec.compiler = None
spec.external = None
spec.external_module = None
@@ -1842,7 +1842,7 @@ class SpecParser(spack.parse.Parser):
spec._set_compiler(self.compiler())
elif self.accept(EQ):
- spec._set_architecture(self.architecture())
+ spec._set_target(self.target())
else:
break
@@ -1860,7 +1860,7 @@ class SpecParser(spack.parse.Parser):
return self.token.value
- def architecture(self):
+ def target(self):
self.expect(ID)
return self.token.value
@@ -2000,10 +2000,10 @@ class UnknownVariantError(SpecError):
"Package %s has no variant %s!" % (pkg, variant))
-class DuplicateArchitectureError(SpecError):
- """Raised when the same architecture occurs in a spec twice."""
+class DuplicateTargetError(SpecError):
+ """Raised when the same target occurs in a spec twice."""
def __init__(self, message):
- super(DuplicateArchitectureError, self).__init__(message)
+ super(DuplicateTargetError, self).__init__(message)
class InconsistentSpecError(SpecError):
@@ -2082,11 +2082,11 @@ class UnsatisfiableVariantSpecError(UnsatisfiableSpecError):
provided, required, "variant")
-class UnsatisfiableArchitectureSpecError(UnsatisfiableSpecError):
- """Raised when a spec architecture conflicts with package constraints."""
+class UnsatisfiableTargetSpecError(UnsatisfiableSpecError):
+ """Raised when a spec target conflicts with package constraints."""
def __init__(self, provided, required):
- super(UnsatisfiableArchitectureSpecError, self).__init__(
- provided, required, "architecture")
+ super(UnsatisfiableTargetSpecError, self).__init__(
+ provided, required, "target")
class UnsatisfiableProviderSpecError(UnsatisfiableSpecError):
diff --git a/lib/spack/spack/test/architecture.py b/lib/spack/spack/test/architecture.py
index 3a7474799a..32b16feeb1 100644
--- a/lib/spack/spack/test/architecture.py
+++ b/lib/spack/spack/test/architecture.py
@@ -6,13 +6,14 @@ import os
import platform
import spack
from spack.architecture import *
-from spack.architectures.cray import Cray
-from spack.architectures.linux import Linux
-from spack.architectures.bgq import Bgq
+from spack.platforms.cray import Cray
+from spack.platforms.linux import Linux
+from spack.platforms.bgq import Bgq
+from spack.platforms.darwin import Darwin
class ArchitectureTest(unittest.TestCase):
- def test_Architecture_class_and_compiler_strategies(self):
+ def test_platform_class_and_compiler_strategies(self):
a = Cray()
t = a.target('default')
self.assertEquals(t.compiler_strategy, 'MODULES')
@@ -21,15 +22,15 @@ class ArchitectureTest(unittest.TestCase):
self.assertEquals(s.compiler_strategy, 'PATH')
def test_sys_type(self):
- output_arch_class = sys_type()
+ output_platform_class = sys_type()
my_arch_class = None
if os.path.exists('/opt/cray/craype'):
- my_arch_class = Cray()
+ my_platform_class = Cray()
elif os.path.exists('/bgsys'):
- my_arch_class = Bgq()
+ my_platform_class = Bgq()
elif 'Linux' in platform.system():
- my_arch_class = Linux()
-# elif 'Darwin' in platform.system():
-# my_arch_class = Darwin()
+ my_platform_class = Linux()
+ elif 'Darwin' in platform.system():
+ my_platform_class = Darwin()
- self.assertEqual(str(output_arch_class), str(my_arch_class))
+ self.assertEqual(str(output_platform_class), str(my_platform_class))
diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py
index f81a2f5af8..2403719134 100644
--- a/lib/spack/spack/test/concretize.py
+++ b/lib/spack/spack/test/concretize.py
@@ -46,8 +46,8 @@ class ConcretizeTest(MockPackagesTest):
if abstract.compiler and abstract.compiler.concrete:
self.assertEqual(abstract.compiler, concrete.compiler)
- if abstract.architecture and abstract.architecture.concrete:
- self.assertEqual(abstract.architecture, concrete.architecture)
+ if abstract.target and abstract.target.concrete:
+ self.assertEqual(abstract.target, concrete.target)
def check_concretize(self, abstract_spec):
diff --git a/lib/spack/spack/test/multimethod.py b/lib/spack/spack/test/multimethod.py
index cd5d9e625e..741dc96072 100644
--- a/lib/spack/spack/test/multimethod.py
+++ b/lib/spack/spack/test/multimethod.py
@@ -91,21 +91,21 @@ class MultiMethodTest(MockPackagesTest):
self.assertEqual(pkg.has_a_default(), 'default')
- def test_architecture_match(self):
+ def test_target_match(self):
pkg = spack.db.get('multimethod=x86_64')
- self.assertEqual(pkg.different_by_architecture(), 'x86_64')
+ self.assertEqual(pkg.different_by_target(), 'x86_64')
pkg = spack.db.get('multimethod=ppc64')
- self.assertEqual(pkg.different_by_architecture(), 'ppc64')
+ self.assertEqual(pkg.different_by_target(), 'ppc64')
pkg = spack.db.get('multimethod=ppc32')
- self.assertEqual(pkg.different_by_architecture(), 'ppc32')
+ self.assertEqual(pkg.different_by_target(), 'ppc32')
pkg = spack.db.get('multimethod=arm64')
- self.assertEqual(pkg.different_by_architecture(), 'arm64')
+ self.assertEqual(pkg.different_by_target(), 'arm64')
pkg = spack.db.get('multimethod=macos')
- self.assertRaises(NoSuchMethodError, pkg.different_by_architecture)
+ self.assertRaises(NoSuchMethodError, pkg.different_by_target)
def test_dependency_match(self):
diff --git a/lib/spack/spack/test/spec_dag.py b/lib/spack/spack/test/spec_dag.py
index 549f829d3e..6a2dd6140f 100644
--- a/lib/spack/spack/test/spec_dag.py
+++ b/lib/spack/spack/test/spec_dag.py
@@ -240,10 +240,10 @@ class SpecDagTest(MockPackagesTest):
self.assertRaises(spack.spec.UnsatisfiableCompilerSpecError, spec.normalize)
- def test_unsatisfiable_architecture(self):
+ def test_unsatisfiable_target(self):
set_pkg_dep('mpileaks', 'mpich=bgqos_0')
spec = Spec('mpileaks ^mpich=sles_10_ppc64 ^callpath ^dyninst ^libelf ^libdwarf')
- self.assertRaises(spack.spec.UnsatisfiableArchitectureSpecError, spec.normalize)
+ self.assertRaises(spack.spec.UnsatisfiableTargetSpecError, spec.normalize)
def test_invalid_dep(self):
diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py
index 6666dbbb52..b8b4fb951c 100644
--- a/lib/spack/spack/test/spec_semantics.py
+++ b/lib/spack/spack/test/spec_semantics.py
@@ -110,7 +110,7 @@ class SpecSematicsTest(MockPackagesTest):
self.check_unsatisfiable('foo %gcc@4.7', '%gcc@4.7.3')
- def test_satisfies_architecture(self):
+ def test_satisfies_target(self):
self.check_satisfies('foo=chaos_5_x86_64_ib', '=chaos_5_x86_64_ib')
self.check_satisfies('foo=bgqos_0', '=bgqos_0')
@@ -266,7 +266,7 @@ class SpecSematicsTest(MockPackagesTest):
self.check_constrain('libelf+debug~foo', 'libelf+debug', 'libelf+debug~foo')
- def test_constrain_arch(self):
+ def test_constrain_target(self):
self.check_constrain('libelf=bgqos_0', 'libelf=bgqos_0', 'libelf=bgqos_0')
self.check_constrain('libelf=bgqos_0', 'libelf', 'libelf=bgqos_0')
diff --git a/var/spack/mock_packages/multimethod/package.py b/var/spack/mock_packages/multimethod/package.py
index 75b1606ffc..f78ef3bb3d 100644
--- a/var/spack/mock_packages/multimethod/package.py
+++ b/var/spack/mock_packages/multimethod/package.py
@@ -101,22 +101,22 @@ class Multimethod(Package):
#
- # Make sure we can switch methods on different architectures
+ # Make sure we can switch methods on different target
#
@when('=x86_64')
- def different_by_architecture(self):
+ def different_by_target(self):
return 'x86_64'
@when('=ppc64')
- def different_by_architecture(self):
+ def different_by_target(self):
return 'ppc64'
@when('=ppc32')
- def different_by_architecture(self):
+ def different_by_target(self):
return 'ppc32'
@when('=arm64')
- def different_by_architecture(self):
+ def different_by_target(self):
return 'arm64'