Fixed things from merge.
This commit is contained in:
parent
688eca23ff
commit
315623d361
8 changed files with 45 additions and 27 deletions
|
@ -202,6 +202,13 @@ def __init__(self, platform_os=None, target=None):
|
|||
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) )
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
_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 init_compiler_config():
|
|||
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 get_compiler(cspec):
|
|||
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)
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ def _valid_virtuals_and_externals(self, spec):
|
|||
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 @@ def concretize_compiler(self, spec):
|
|||
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 @@ def _proper_compiler_style(cspec, architecture):
|
|||
return compilers
|
||||
|
||||
|
||||
all_compilers = spack.compilers.all_compilers()
|
||||
all_compilers = spack.compilers.all_compilers(spec.architecture)
|
||||
|
||||
if (spec.compiler and
|
||||
spec.compiler.concrete and
|
||||
|
|
|
@ -168,6 +168,10 @@
|
|||
{'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 @@
|
|||
'type': 'boolean',
|
||||
'default': False,
|
||||
},
|
||||
'module': {
|
||||
'anyOf' : [{'type': 'string'},
|
||||
{'type': 'null'}]
|
||||
},
|
||||
'providers': {
|
||||
'type': 'object',
|
||||
'default': {},
|
||||
|
|
|
@ -542,6 +542,7 @@ def concrete(self):
|
|||
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)
|
||||
|
||||
|
|
|
@ -92,10 +92,10 @@ def test_target_match(self):
|
|||
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:
|
||||
|
|
Loading…
Reference in a new issue