summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Becker <becker33@llnl.gov>2016-03-24 16:55:46 -0700
committerGregory Becker <becker33@llnl.gov>2016-03-24 16:55:46 -0700
commit315623d3612d64fd058324d4dbbe5264def759c0 (patch)
treee63accb3c606bc9e6575d43570ad1b186b6996a6
parent688eca23ff4488a4cd90125b69d46cb69271a5cd (diff)
downloadspack-315623d3612d64fd058324d4dbbe5264def759c0.tar.gz
spack-315623d3612d64fd058324d4dbbe5264def759c0.tar.bz2
spack-315623d3612d64fd058324d4dbbe5264def759c0.tar.xz
spack-315623d3612d64fd058324d4dbbe5264def759c0.zip
Fixed things from merge.
-rw-r--r--lib/spack/spack/architecture.py7
-rw-r--r--lib/spack/spack/build_environment.py10
-rw-r--r--lib/spack/spack/cmd/compiler.py2
-rw-r--r--lib/spack/spack/compilers/__init__.py34
-rw-r--r--lib/spack/spack/concretize.py6
-rw-r--r--lib/spack/spack/config.py8
-rw-r--r--lib/spack/spack/spec.py1
-rw-r--r--lib/spack/spack/test/multimethod.py4
8 files changed, 45 insertions, 27 deletions
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py
index aef38b8a55..8d9686cf99 100644
--- a/lib/spack/spack/architecture.py
+++ b/lib/spack/spack/architecture.py
@@ -202,6 +202,13 @@ class Arch(object):
self.platform_os = platform_os
self.target = target
+ @property
+ def concrete(self):
+ return all( (self.platform is not None, isinstance(self.platform, Platform),
+ self.platform_os is not None, isinstance(self.platform_os, OperatingSystem),
+ self.target is not None, isinstance(self.target, Target) ) )
+
+
def __str__(self):
return (str(self.platform) +"-"+
str(self.platform_os) + "-" + str(self.target) )
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index a64ce8aeb4..8ed3c4e1a1 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -101,12 +101,12 @@ def load_module(mod):
# We do this without checking that they are already installed
# for ease of programming because unloading a module that is not
# loaded does nothing.
- text = modulecmd('show', mod, return_oe=True).split()
+ text = modulecmd('show', mod, output=str, error=str).split()
for i, word in enumerate(text):
if word == 'conflict':
- exec(compile(modulecmd('unload', text[i+1], return_oe=True), '<string>', 'exec'))
+ exec(compile(modulecmd('unload', text[i+1], output=str, error=str), '<string>', 'exec'))
# Load the module now that there are no conflicts
- load = modulecmd('load', mod, return_oe=True)
+ load = modulecmd('load', mod, output=str, error=str)
exec(compile(load, '<string>', 'exec'))
@@ -119,7 +119,7 @@ def get_path_from_module(mod):
modulecmd.add_default_arg('python')
# Read the module
- text = modulecmd('show', mod, return_oe=True).split('\n')
+ text = modulecmd('show', mod, output=str, error=str).split('\n')
# If it lists its package directory, return that
for line in text:
@@ -348,8 +348,8 @@ def parent_class_modules(cls):
def setup_package(pkg):
"""Execute all environment setup routines."""
- set_compiler_environment_variables(pkg)
set_build_environment_variables(pkg)
+ set_compiler_environment_variables(pkg)
# If a user makes their own package repo, e.g.
# spack.repos.mystuff.libelf.Libelf, and they inherit from
diff --git a/lib/spack/spack/cmd/compiler.py b/lib/spack/spack/cmd/compiler.py
index bed5db3d47..a7de61e1e5 100644
--- a/lib/spack/spack/cmd/compiler.py
+++ b/lib/spack/spack/cmd/compiler.py
@@ -23,7 +23,7 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import sys
-import argparse
+from external import argparse
import llnl.util.tty as tty
from llnl.util.tty.color import colorize
diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py
index 93c5172dde..55e2db700f 100644
--- a/lib/spack/spack/compilers/__init__.py
+++ b/lib/spack/spack/compilers/__init__.py
@@ -46,7 +46,7 @@ from spack.util.environment import get_path
_imported_compilers_module = 'spack.compilers'
_required_instance_vars = ['cc', 'cxx', 'f77', 'fc']
-_optional_instance_vars = ['modules']
+_optional_instance_vars = ['modules', 'strategy']
_default_order = []
# TODO: customize order in config file
@@ -69,7 +69,7 @@ def _to_dict(compiler):
return {
str(compiler.spec) : dict(
(attr, getattr(compiler, attr, None))
- for attr in _required_instance_vars)
+ for attr in _required_instance_vars + _optional_instance_vars)
}
@@ -77,20 +77,24 @@ def get_compiler_config(arch=None, scope=None):
"""Return the compiler configuration for the specified architecture.
"""
# Check whether we're on a front-end (native) architecture.
- my_arch = spack.architecture.sys_type()
+
+ my_arch = spack.architecture.Arch()
+ if isinstance(arch, basestring):
+ if arch == 'all':
+ my_arch.platform.name = 'all'
+ arch = my_arch
if arch is None:
arch = my_arch
def init_compiler_config():
"""Compiler search used when Spack has no compilers."""
- config[arch] = {}
+ config[arch.platform.name] = {}
compilers = find_compilers(*get_path('PATH'))
for compiler in compilers:
- config[arch].update(_to_dict(compiler))
+ config[arch.platform.name].update(_to_dict(compiler))
spack.config.update_config('compilers', config, scope=scope)
config = spack.config.get_config('compilers', scope=scope)
-
# Update the configuration if there are currently no compilers
# configured. Avoid updating automatically if there ARE site
# compilers configured but no user ones.
@@ -105,7 +109,7 @@ def get_compiler_config(arch=None, scope=None):
if not site_config:
init_compiler_config()
- return config[arch] if arch in config else {}
+ return config[arch.platform.name] if arch.platform.name in config else {}
def add_compilers_to_config(compilers, arch=None, scope=None):
@@ -117,15 +121,15 @@ def add_compilers_to_config(compilers, arch=None, scope=None):
- scope: configuration scope to modify.
"""
if arch is None:
- arch = spack.architecture.sys_type()
+ arch = spack.architecture.Arch()
compiler_config = get_compiler_config(arch, scope)
for compiler in compilers:
compiler_config[str(compiler.spec)] = dict(
(c, getattr(compiler, c, "None"))
- for c in _required_instance_vars + ['strategy'] + _optional_instance_vars)
+ for c in _required_instance_vars + _optional_instance_vars)
- update = { arch : compiler_config }
+ update = { arch.platform.name : compiler_config }
spack.config.update_config('compilers', update, scope)
@@ -139,7 +143,7 @@ def remove_compiler_from_config(compiler_spec, arch=None, scope=None):
- scope: configuration scope to modify.
"""
if arch is None:
- arch = spack.architecture.sys_type()
+ arch = spack.architecture.Arch()
compiler_config = get_compiler_config(arch, scope)
del compiler_config[str(compiler_spec)]
@@ -154,7 +158,6 @@ def all_compilers_config(arch=None, scope=None):
"""
# Get compilers for this architecture.
arch_config = get_compiler_config(arch, scope)
-
# Merge 'all' compilers with arch-specific ones.
# Arch-specific compilers have higher precedence.
merged_config = get_compiler_config('all', scope=scope)
@@ -262,10 +265,9 @@ def compilers_for_spec(compiler_spec, arch=None, scope=None):
else:
compiler_paths.append(None)
- for m in _optional_instance_vars:
- if m not in items:
- items[m] = None
- mods = items[m]
+ if 'modules' not in items:
+ items['modules'] = None
+ mods = items['modules']
return cls(cspec, strategy, compiler_paths, mods)
diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py
index 330ecdf509..c5dad93aef 100644
--- a/lib/spack/spack/concretize.py
+++ b/lib/spack/spack/concretize.py
@@ -79,7 +79,7 @@ class DefaultConcretizer(object):
externals = spec_externals(pkg)
buildable = not is_spec_nobuild(pkg)
if buildable:
- result.append((pkg, None))
+ result.append((pkg, None, None))
for ext in externals:
if ext[0].satisfies(spec):
result.append(ext)
@@ -354,7 +354,7 @@ class DefaultConcretizer(object):
link to this one, to maximize compatibility.
"""
# Pass on concretizing the compiler if the target is not yet determined
- if not spec.architecture.target:
+ if not spec.architecture.platform_os:
#Although this usually means changed, this means awaiting other changes
return True
@@ -371,7 +371,7 @@ class DefaultConcretizer(object):
return compilers
- all_compilers = spack.compilers.all_compilers()
+ all_compilers = spack.compilers.all_compilers(spec.architecture)
if (spec.compiler and
spec.compiler.concrete and
diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py
index 182c174baa..c9a770a53f 100644
--- a/lib/spack/spack/config.py
+++ b/lib/spack/spack/config.py
@@ -168,6 +168,10 @@ section_schemas = {
{'type' : 'null' }]},
'fc': { 'anyOf': [ {'type' : 'string' },
{'type' : 'null' }]},
+ 'strategy': { 'anyOf': [ {'type' : 'string' },
+ {'type' : 'null' }]},
+ 'modules': { 'anyOf': [ {'type' : 'string' },
+ {'type' : 'null' }]}
},},},},},},},},
'mirrors': {
@@ -224,6 +228,10 @@ section_schemas = {
'type': 'boolean',
'default': False,
},
+ 'module': {
+ 'anyOf' : [{'type': 'string'},
+ {'type': 'null'}]
+ },
'providers': {
'type': 'object',
'default': {},
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index d800a1667d..fa2e9fd4c8 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -542,6 +542,7 @@ class Spec(object):
and self.versions.concrete
and self.variants.concrete
and self.architecture
+ and self.architecture.concrete
and self.compiler and self.compiler.concrete
and self.dependencies.concrete)
diff --git a/lib/spack/spack/test/multimethod.py b/lib/spack/spack/test/multimethod.py
index 020d25015d..6a723d123e 100644
--- a/lib/spack/spack/test/multimethod.py
+++ b/lib/spack/spack/test/multimethod.py
@@ -92,10 +92,10 @@ class MultiMethodTest(MockPackagesTest):
platform = spack.architecture.sys_type()
targets = platform.targets.values()
for target in targets[:-1]:
- pkg = spack.db.get('multimethod='+target.name)
+ pkg = spack.repo.get('multimethod='+target.name)
self.assertEqual(pkg.different_by_target(), target.name)
- pkg = spack.db.get('multimethod='+targets[-1].name)
+ pkg = spack.repo.get('multimethod='+targets[-1].name)
if len(targets) == 1:
self.assertEqual(pkg.different_by_target(), targets[-1].name)
else: