summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_environment.py23
-rw-r--r--lib/spack/spack/spec.py10
-rw-r--r--lib/spack/spack/test/__init__.py40
-rw-r--r--lib/spack/spack/test/config.py29
-rw-r--r--lib/spack/spack/test/multimethod.py22
5 files changed, 30 insertions, 94 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 4974cc1e76..7aeea5c672 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -213,13 +213,12 @@ def set_compiler_environment_variables(pkg):
if flags[flag] != []:
env.set('SPACK_' + flag.upper(), ' '.join(f for f in flags[flag]))
-#ifdef NEW
env.set('SPACK_COMPILER_SPEC', str(pkg.spec.compiler))
- return env
-#else /* not NEW */
+
for mod in compiler.modules:
load_module(mod)
-#endif /* not NEW */
+
+ return env
def set_build_environment_variables(pkg, env):
@@ -283,16 +282,13 @@ def set_build_environment_variables(pkg, env):
pcdir = join_path(p, maybe, 'pkgconfig')
if os.path.isdir(pcdir):
pkg_config_dirs.append(pcdir)
-#ifdef NEW
- env.set_path('PKG_CONFIG_PATH', pkg_config_dirs)
- return env
-#else /* not NEW */
- path_put_first("PKG_CONFIG_PATH", pkg_config_dirs)
+ env.prepend_path('PKG_CONFIG_PATH', pkg_config_dirs)
if pkg.spec.architecture.target.module_name:
load_module(pkg.spec.architecture.target.module_name)
-#endif /* not NEW */
+
+ return env
def set_module_variables_for_package(pkg, module):
@@ -368,16 +364,13 @@ def set_module_variables_for_package(pkg, module):
def get_rpaths(pkg):
"""Get a list of all the rpaths for a package."""
- for spec in pkg.spec.traverse(root=False):
- if spec.external_module:
- load_module(spec.external_module)
- spec.external = get_path_from_module(spec.external_module)
-
rpaths = [pkg.prefix.lib, pkg.prefix.lib64]
rpaths.extend(d.prefix.lib for d in pkg.spec.dependencies.values()
if os.path.isdir(d.prefix.lib))
rpaths.extend(d.prefix.lib64 for d in pkg.spec.dependencies.values()
if os.path.isdir(d.prefix.lib64))
+ for mod in pkg.spec.compiler.modules:
+ rpaths.append(get_path_for_module(mod))
return rpaths
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index e61ffc0912..9d217d17ca 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -120,6 +120,7 @@ from spack.version import *
from spack.util.string import *
from spack.util.prefix import Prefix
from spack.virtual import ProviderIndex
+from spack.build_environment import get_path_from_module, load_module
# Valid pattern for an identifier in Spack
identifier_re = r'\w[\w-]*'
@@ -1085,6 +1086,15 @@ class Spec(object):
if s.namespace is None:
s.namespace = spack.repo.repo_for_pkg(s.name).namespace
+
+ for s in self.traverse(root=False):
+ if spec.external_module:
+ compiler = spack.compilers.compiler_for_spec(spec.compiler, spec.architecture.platform_os)
+ for mod in compiler.modules:
+ load_module(mod)
+
+ spec.external = get_path_from_module(spec.external_module)
+
# Mark everything in the spec as concrete, as well.
self._mark_concrete()
diff --git a/lib/spack/spack/test/__init__.py b/lib/spack/spack/test/__init__.py
index cac7c2f058..480e6290e7 100644
--- a/lib/spack/spack/test/__init__.py
+++ b/lib/spack/spack/test/__init__.py
@@ -31,8 +31,8 @@ from llnl.util.filesystem import join_path
from llnl.util.tty.colify import colify
from spack.test.tally_plugin import Tally
"""Names of tests to be included in Spack's test suite"""
-#ifdef NEW
-test_names = ['versions', 'url_parse', 'url_substitution', 'packages', 'stage',
+
+test_names = ['architecture', 'versions', 'url_parse', 'url_substitution', 'packages', 'stage',
'spec_syntax', 'spec_semantics', 'spec_dag', 'concretize',
'multimethod', 'install', 'package_sanity', 'config',
'directory_layout', 'pattern', 'python_version', 'git_fetch',
@@ -41,42 +41,6 @@ test_names = ['versions', 'url_parse', 'url_substitution', 'packages', 'stage',
'make_executable', 'configure_guess', 'lock', 'database',
'namespace_trie', 'yaml', 'sbang', 'environment',
'cmd.uninstall', 'cmd.test_install']
-#else /* not NEW */
-test_names = ['architecture',
- 'versions',
- 'url_parse',
- 'url_substitution',
- 'packages',
- 'stage',
- 'spec_syntax',
- 'spec_semantics',
- 'spec_dag',
- 'concretize',
- 'multimethod',
- 'install',
- 'package_sanity',
- 'config',
- 'directory_layout',
- 'pattern',
- 'python_version',
- 'git_fetch',
- 'svn_fetch',
- 'hg_fetch',
- 'mirror',
- 'url_extrapolate',
- 'cc',
- 'link_tree',
- 'spec_yaml',
- 'optional_deps',
- 'make_executable',
- 'configure_guess',
- 'unit_install',
- 'lock',
- 'database',
- 'namespace_trie',
- 'yaml',
- 'sbang']
-#endif /* not NEW */
def list_tests():
diff --git a/lib/spack/spack/test/config.py b/lib/spack/spack/test/config.py
index 7d71cc1c7f..8fffc09437 100644
--- a/lib/spack/spack/test/config.py
+++ b/lib/spack/spack/test/config.py
@@ -142,19 +142,6 @@ class ConfigTest(MockPackagesTest):
"""Check that named compilers in comps match Spack's config."""
config = spack.config.get_config('compilers')
compiler_list = ['cc', 'cxx', 'f77', 'fc']
-#ifdef NEW
- for key in compiler_names:
- for c in compiler_list:
- expected = comps[arch][key][c]
- actual = config[arch][key][c]
- self.assertEqual(expected, actual)
-
- def test_write_list_in_memory(self):
- spack.config.update_config('repos', repos_low, 'test_low_priority')
- spack.config.update_config('repos', repos_high, 'test_high_priority')
- config = spack.config.get_config('repos')
- self.assertEqual(config, repos_high+repos_low)
-#else /* not NEW */
param_list = ['modules', 'paths', 'spec', 'operating_system']
for alias, compiler in config.items():
if compiler['spec'] in compiler_names:
@@ -166,7 +153,12 @@ class ConfigTest(MockPackagesTest):
expected = comps[alias]['paths'][c]
actual = config[alias]['paths'][c]
self.assertEqual(expected, actual)
-#endif /* not NEW */
+
+ def test_write_list_in_memory(self):
+ spack.config.update_config('repos', repos_low, 'test_low_priority')
+ spack.config.update_config('repos', repos_high, 'test_high_priority')
+ config = spack.config.get_config('repos')
+ self.assertEqual(config, repos_high+repos_low)
def test_write_key_in_memory(self):
# Write b_comps "on top of" a_comps.
@@ -187,9 +179,8 @@ class ConfigTest(MockPackagesTest):
spack.config.clear_config_caches()
# Same check again, to ensure consistency.
-#ifdef NEW
- self.check_config(a_comps, 'x86_64_E5v2_IntelIB', 'gcc@4.7.3', 'gcc@4.5.0')
- self.check_config(b_comps, 'x86_64_E5v3', 'icc@10.0', 'icc@11.1', 'clang@3.3')
+ self.check_config(a_comps, 'gcc@4.7.3', 'gcc@4.5.0')
+ self.check_config(b_comps, 'icc@10.0', 'icc@11.1', 'clang@3.3')
def test_write_to_same_priority_file(self):
# Write b_comps in the same file as a_comps.
@@ -200,9 +191,5 @@ class ConfigTest(MockPackagesTest):
spack.config.clear_config_caches()
# Same check again, to ensure consistency.
- self.check_config(a_comps, 'x86_64_E5v2_IntelIB', 'gcc@4.7.3', 'gcc@4.5.0')
- self.check_config(b_comps, 'x86_64_E5v3', 'icc@10.0', 'icc@11.1', 'clang@3.3')
-#else /* not NEW */
self.check_config(a_comps, 'gcc@4.7.3', 'gcc@4.5.0')
self.check_config(b_comps, 'icc@10.0', 'icc@11.1', 'clang@3.3')
-#endif /* not NEW */
diff --git a/lib/spack/spack/test/multimethod.py b/lib/spack/spack/test/multimethod.py
index 7636bd6c38..034e6b3923 100644
--- a/lib/spack/spack/test/multimethod.py
+++ b/lib/spack/spack/test/multimethod.py
@@ -92,36 +92,18 @@ class MultiMethodTest(MockPackagesTest):
self.assertEqual(pkg.has_a_default(), 'default')
-#ifdef NEW
- def test_architecture_match(self):
- pkg = spack.repo.get('multimethod arch=x86_64')
- self.assertEqual(pkg.different_by_architecture(), 'x86_64')
-
- pkg = spack.repo.get('multimethod arch=ppc64')
- self.assertEqual(pkg.different_by_architecture(), 'ppc64')
-
- pkg = spack.repo.get('multimethod arch=ppc32')
- self.assertEqual(pkg.different_by_architecture(), 'ppc32')
-
- pkg = spack.repo.get('multimethod arch=arm64')
- self.assertEqual(pkg.different_by_architecture(), 'arm64')
-
- pkg = spack.repo.get('multimethod arch=macos')
- self.assertRaises(NoSuchMethodError, pkg.different_by_architecture)
-#else /* not NEW */
def test_target_match(self):
platform = spack.architecture.sys_type()
targets = platform.targets.values()
for target in targets[:-1]:
- pkg = spack.repo.get('multimethod='+target.name)
+ pkg = spack.repo.get('multimethod target='+target.name)
self.assertEqual(pkg.different_by_target(), target.name)
- pkg = spack.repo.get('multimethod='+targets[-1].name)
+ pkg = spack.repo.get('multimethod target='+targets[-1].name)
if len(targets) == 1:
self.assertEqual(pkg.different_by_target(), targets[-1].name)
else:
self.assertRaises(NoSuchMethodError, pkg.different_by_target)
-#endif /* not NEW */
def test_dependency_match(self):