Fixed things from merge.
This commit is contained in:
parent
688eca23ff
commit
315623d361
@ -202,6 +202,13 @@ def __init__(self, platform_os=None, target=None):
|
|||||||
self.platform_os = platform_os
|
self.platform_os = platform_os
|
||||||
self.target = target
|
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):
|
def __str__(self):
|
||||||
return (str(self.platform) +"-"+
|
return (str(self.platform) +"-"+
|
||||||
str(self.platform_os) + "-" + str(self.target) )
|
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
|
# We do this without checking that they are already installed
|
||||||
# for ease of programming because unloading a module that is not
|
# for ease of programming because unloading a module that is not
|
||||||
# loaded does nothing.
|
# 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):
|
for i, word in enumerate(text):
|
||||||
if word == 'conflict':
|
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 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'))
|
exec(compile(load, '<string>', 'exec'))
|
||||||
|
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ def get_path_from_module(mod):
|
|||||||
modulecmd.add_default_arg('python')
|
modulecmd.add_default_arg('python')
|
||||||
|
|
||||||
# Read the module
|
# 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
|
# If it lists its package directory, return that
|
||||||
for line in text:
|
for line in text:
|
||||||
@ -348,8 +348,8 @@ def parent_class_modules(cls):
|
|||||||
|
|
||||||
def setup_package(pkg):
|
def setup_package(pkg):
|
||||||
"""Execute all environment setup routines."""
|
"""Execute all environment setup routines."""
|
||||||
set_compiler_environment_variables(pkg)
|
|
||||||
set_build_environment_variables(pkg)
|
set_build_environment_variables(pkg)
|
||||||
|
set_compiler_environment_variables(pkg)
|
||||||
|
|
||||||
# If a user makes their own package repo, e.g.
|
# If a user makes their own package repo, e.g.
|
||||||
# spack.repos.mystuff.libelf.Libelf, and they inherit from
|
# spack.repos.mystuff.libelf.Libelf, and they inherit from
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
from external import argparse
|
||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
from llnl.util.tty.color import colorize
|
from llnl.util.tty.color import colorize
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
_imported_compilers_module = 'spack.compilers'
|
_imported_compilers_module = 'spack.compilers'
|
||||||
_required_instance_vars = ['cc', 'cxx', 'f77', 'fc']
|
_required_instance_vars = ['cc', 'cxx', 'f77', 'fc']
|
||||||
_optional_instance_vars = ['modules']
|
_optional_instance_vars = ['modules', 'strategy']
|
||||||
|
|
||||||
_default_order = []
|
_default_order = []
|
||||||
# TODO: customize order in config file
|
# TODO: customize order in config file
|
||||||
@ -69,7 +69,7 @@ def _to_dict(compiler):
|
|||||||
return {
|
return {
|
||||||
str(compiler.spec) : dict(
|
str(compiler.spec) : dict(
|
||||||
(attr, getattr(compiler, attr, None))
|
(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.
|
"""Return the compiler configuration for the specified architecture.
|
||||||
"""
|
"""
|
||||||
# Check whether we're on a front-end (native) 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:
|
if arch is None:
|
||||||
arch = my_arch
|
arch = my_arch
|
||||||
|
|
||||||
def init_compiler_config():
|
def init_compiler_config():
|
||||||
"""Compiler search used when Spack has no compilers."""
|
"""Compiler search used when Spack has no compilers."""
|
||||||
config[arch] = {}
|
config[arch.platform.name] = {}
|
||||||
compilers = find_compilers(*get_path('PATH'))
|
compilers = find_compilers(*get_path('PATH'))
|
||||||
for compiler in compilers:
|
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)
|
spack.config.update_config('compilers', config, scope=scope)
|
||||||
|
|
||||||
config = spack.config.get_config('compilers', scope=scope)
|
config = spack.config.get_config('compilers', scope=scope)
|
||||||
|
|
||||||
# Update the configuration if there are currently no compilers
|
# Update the configuration if there are currently no compilers
|
||||||
# configured. Avoid updating automatically if there ARE site
|
# configured. Avoid updating automatically if there ARE site
|
||||||
# compilers configured but no user ones.
|
# compilers configured but no user ones.
|
||||||
@ -105,7 +109,7 @@ def init_compiler_config():
|
|||||||
if not site_config:
|
if not site_config:
|
||||||
init_compiler_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):
|
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.
|
- scope: configuration scope to modify.
|
||||||
"""
|
"""
|
||||||
if arch is None:
|
if arch is None:
|
||||||
arch = spack.architecture.sys_type()
|
arch = spack.architecture.Arch()
|
||||||
|
|
||||||
compiler_config = get_compiler_config(arch, scope)
|
compiler_config = get_compiler_config(arch, scope)
|
||||||
for compiler in compilers:
|
for compiler in compilers:
|
||||||
compiler_config[str(compiler.spec)] = dict(
|
compiler_config[str(compiler.spec)] = dict(
|
||||||
(c, getattr(compiler, c, "None"))
|
(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)
|
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.
|
- scope: configuration scope to modify.
|
||||||
"""
|
"""
|
||||||
if arch is None:
|
if arch is None:
|
||||||
arch = spack.architecture.sys_type()
|
arch = spack.architecture.Arch()
|
||||||
|
|
||||||
compiler_config = get_compiler_config(arch, scope)
|
compiler_config = get_compiler_config(arch, scope)
|
||||||
del compiler_config[str(compiler_spec)]
|
del compiler_config[str(compiler_spec)]
|
||||||
@ -154,7 +158,6 @@ def all_compilers_config(arch=None, scope=None):
|
|||||||
"""
|
"""
|
||||||
# Get compilers for this architecture.
|
# Get compilers for this architecture.
|
||||||
arch_config = get_compiler_config(arch, scope)
|
arch_config = get_compiler_config(arch, scope)
|
||||||
|
|
||||||
# Merge 'all' compilers with arch-specific ones.
|
# Merge 'all' compilers with arch-specific ones.
|
||||||
# Arch-specific compilers have higher precedence.
|
# Arch-specific compilers have higher precedence.
|
||||||
merged_config = get_compiler_config('all', scope=scope)
|
merged_config = get_compiler_config('all', scope=scope)
|
||||||
@ -262,10 +265,9 @@ def get_compiler(cspec):
|
|||||||
else:
|
else:
|
||||||
compiler_paths.append(None)
|
compiler_paths.append(None)
|
||||||
|
|
||||||
for m in _optional_instance_vars:
|
if 'modules' not in items:
|
||||||
if m not in items:
|
items['modules'] = None
|
||||||
items[m] = None
|
mods = items['modules']
|
||||||
mods = items[m]
|
|
||||||
|
|
||||||
return cls(cspec, strategy, compiler_paths, mods)
|
return cls(cspec, strategy, compiler_paths, mods)
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ def _valid_virtuals_and_externals(self, spec):
|
|||||||
externals = spec_externals(pkg)
|
externals = spec_externals(pkg)
|
||||||
buildable = not is_spec_nobuild(pkg)
|
buildable = not is_spec_nobuild(pkg)
|
||||||
if buildable:
|
if buildable:
|
||||||
result.append((pkg, None))
|
result.append((pkg, None, None))
|
||||||
for ext in externals:
|
for ext in externals:
|
||||||
if ext[0].satisfies(spec):
|
if ext[0].satisfies(spec):
|
||||||
result.append(ext)
|
result.append(ext)
|
||||||
@ -354,7 +354,7 @@ def concretize_compiler(self, spec):
|
|||||||
link to this one, to maximize compatibility.
|
link to this one, to maximize compatibility.
|
||||||
"""
|
"""
|
||||||
# Pass on concretizing the compiler if the target is not yet determined
|
# 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
|
#Although this usually means changed, this means awaiting other changes
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ def _proper_compiler_style(cspec, architecture):
|
|||||||
return compilers
|
return compilers
|
||||||
|
|
||||||
|
|
||||||
all_compilers = spack.compilers.all_compilers()
|
all_compilers = spack.compilers.all_compilers(spec.architecture)
|
||||||
|
|
||||||
if (spec.compiler and
|
if (spec.compiler and
|
||||||
spec.compiler.concrete and
|
spec.compiler.concrete and
|
||||||
|
@ -168,6 +168,10 @@
|
|||||||
{'type' : 'null' }]},
|
{'type' : 'null' }]},
|
||||||
'fc': { 'anyOf': [ {'type' : 'string' },
|
'fc': { 'anyOf': [ {'type' : 'string' },
|
||||||
{'type' : 'null' }]},
|
{'type' : 'null' }]},
|
||||||
|
'strategy': { 'anyOf': [ {'type' : 'string' },
|
||||||
|
{'type' : 'null' }]},
|
||||||
|
'modules': { 'anyOf': [ {'type' : 'string' },
|
||||||
|
{'type' : 'null' }]}
|
||||||
},},},},},},},},
|
},},},},},},},},
|
||||||
|
|
||||||
'mirrors': {
|
'mirrors': {
|
||||||
@ -224,6 +228,10 @@
|
|||||||
'type': 'boolean',
|
'type': 'boolean',
|
||||||
'default': False,
|
'default': False,
|
||||||
},
|
},
|
||||||
|
'module': {
|
||||||
|
'anyOf' : [{'type': 'string'},
|
||||||
|
{'type': 'null'}]
|
||||||
|
},
|
||||||
'providers': {
|
'providers': {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
'default': {},
|
'default': {},
|
||||||
|
@ -542,6 +542,7 @@ def concrete(self):
|
|||||||
and self.versions.concrete
|
and self.versions.concrete
|
||||||
and self.variants.concrete
|
and self.variants.concrete
|
||||||
and self.architecture
|
and self.architecture
|
||||||
|
and self.architecture.concrete
|
||||||
and self.compiler and self.compiler.concrete
|
and self.compiler and self.compiler.concrete
|
||||||
and self.dependencies.concrete)
|
and self.dependencies.concrete)
|
||||||
|
|
||||||
|
@ -92,10 +92,10 @@ def test_target_match(self):
|
|||||||
platform = spack.architecture.sys_type()
|
platform = spack.architecture.sys_type()
|
||||||
targets = platform.targets.values()
|
targets = platform.targets.values()
|
||||||
for target in targets[:-1]:
|
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)
|
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:
|
if len(targets) == 1:
|
||||||
self.assertEqual(pkg.different_by_target(), targets[-1].name)
|
self.assertEqual(pkg.different_by_target(), targets[-1].name)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user