summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/find.py3
-rw-r--r--lib/spack/spack/compiler.py65
-rw-r--r--lib/spack/spack/compilers/__init__.py23
-rw-r--r--lib/spack/spack/test/spec_dag.py18
-rw-r--r--lib/spack/spack/test/spec_semantics.py109
5 files changed, 82 insertions, 136 deletions
diff --git a/lib/spack/spack/cmd/find.py b/lib/spack/spack/cmd/find.py
index c768faea91..8b91f45cfd 100644
--- a/lib/spack/spack/cmd/find.py
+++ b/lib/spack/spack/cmd/find.py
@@ -239,8 +239,5 @@ def find(parser, args):
mode=args.mode,
long=args.long,
very_long=args.very_long,
-#ifdef NEW
show_flags=args.show_flags)
-#else /* not NEW */
namespace=args.namespace)
-#endif /* not NEW */
diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py
index dfae72010a..ce4555bc56 100644
--- a/lib/spack/spack/compiler.py
+++ b/lib/spack/spack/compiler.py
@@ -101,7 +101,6 @@ class Compiler(object):
def cxx_rpath_arg(self):
return '-Wl,-rpath,'
-#ifdef NEW
@property
def f77_rpath_arg(self):
return '-Wl,-rpath,'
@@ -109,32 +108,32 @@ class Compiler(object):
@property
def fc_rpath_arg(self):
return '-Wl,-rpath,'
-#else /* not NEW */
# Cray PrgEnv name that can be used to load this compiler
PrgEnv = None
-
# Name of module used to switch versions of this compiler
PrgEnv_compiler = None
-#endif /* not NEW */
-
-#ifdef NEW
-
- def __init__(self, cspec, cc, cxx, f77, fc, **kwargs):
-#else /* not NEW */
- def __init__(self, cspec, operating_system, paths, modules=[], alias=None):
-#endif /* not NEW */
+ def __init__(self, cspec, operating_system,
+ paths, modules=[], alias=None, **kwargs):
def check(exe):
if exe is None:
return None
_verify_executables(exe)
return exe
-#ifdef NEW
- self.cc = check(cc)
- self.cxx = check(cxx)
- self.f77 = check(f77)
- self.fc = check(fc)
+ self.cc = check(paths[0])
+ self.cxx = check(paths[1])
+ if len(paths) > 2:
+ self.f77 = check(paths[2])
+ if len(paths) == 3:
+ self.fc = self.f77
+ else:
+ self.fc = check(paths[3])
+
+ #self.cc = check(cc)
+ #self.cxx = check(cxx)
+ #self.f77 = check(f77)
+ #self.fc = check(fc)
# Unfortunately have to make sure these params are accepted
# in the same order they are returned by sorted(flags)
@@ -145,19 +144,7 @@ class Compiler(object):
if value is not None:
self.flags[flag] = value.split()
-#else /* not NEW */
self.operating_system = operating_system
-
- self.cc = check(paths[0])
- self.cxx = check(paths[1])
- if len(paths) > 2:
- self.f77 = check(paths[2])
- if len(paths) == 3:
- self.fc = self.f77
- else:
- self.fc = check(paths[3])
-
-#endif /* not NEW */
self.spec = cspec
self.modules = modules
self.alias = alias
@@ -287,28 +274,6 @@ class Compiler(object):
successful.reverse()
return dict(((v, p, s), path) for v, p, s, path in successful)
- @classmethod
- def default_version(cls, cc):
- """Override just this to override all compiler version functions."""
- return dumpversion(cc)
-
- @classmethod
- def cc_version(cls, cc):
- return cls.default_version(cc)
-
- @classmethod
- def cxx_version(cls, cxx):
- return cls.default_version(cxx)
-
- @classmethod
- def f77_version(cls, f77):
- return cls.default_version(f77)
-
- @classmethod
- def fc_version(cls, fc):
- return cls.default_version(fc)
-
-
def __repr__(self):
"""Return a string representation of the compiler toolchain."""
return self.__str__()
diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py
index 000ef2058e..3432c142bf 100644
--- a/lib/spack/spack/compilers/__init__.py
+++ b/lib/spack/spack/compilers/__init__.py
@@ -254,17 +254,18 @@ def compilers_for_spec(compiler_spec, scope=None):
else:
operating_system = None
- compilers.append(cls(cspec, operating_system, compiler_paths, mods, alias))
-
-#ifdef NEW
- flags = {}
- for f in spack.spec.FlagMap.valid_compiler_flags():
- if f in items:
- flags[f] = items[f]
- return cls(cspec, *compiler_paths, **flags)
-#else /* not NEW */
- return compilers
-#endif /* not NEW */
+ flags = {}
+ for f in spack.spec.FlagMap.valid_compiler_flags():
+ if f in items:
+ flags[f] = items[f]
+
+ compilers.append(cls(cspec, operating_system, compiler_paths, mods, alias, **flags))
+
+##ifdef NEW
+# return cls(cspec, *compiler_paths, **flags)
+##else /* not NEW */
+# return compilers
+##endif /* not NEW */
matches = set(find(compiler_spec, scope))
compilers = []
diff --git a/lib/spack/spack/test/spec_dag.py b/lib/spack/spack/test/spec_dag.py
index 3c005c4ead..99a986a528 100644
--- a/lib/spack/spack/test/spec_dag.py
+++ b/lib/spack/spack/test/spec_dag.py
@@ -29,6 +29,7 @@ You can find the dummy packages here::
spack/lib/spack/spack/test/mock_packages
"""
import spack
+import spack.architecture
import spack.package
from llnl.util.lang import list_modules
@@ -240,21 +241,12 @@ class SpecDagTest(MockPackagesTest):
self.assertRaises(spack.spec.UnsatisfiableCompilerSpecError, spec.normalize)
-#ifdef NEW
def test_unsatisfiable_architecture(self):
- self.set_pkg_dep('mpileaks', 'mpich arch=bgqos_0')
- spec = Spec('mpileaks ^mpich arch=sles_10_ppc64 ^callpath ^dyninst ^libelf ^libdwarf')
- self.assertRaises(spack.spec.UnsatisfiableArchitectureSpecError, spec.normalize)
-#else /* not NEW */
- def test_unsatisfiable_target(self):
platform = spack.architecture.sys_type()
- if len(platform.targets) > 1:
- first = platform.targets.values()[0].name
- second = platform.targets.values()[1].name
- self.set_pkg_dep('mpileaks', 'mpich='+first)
- spec = Spec('mpileaks ^mpich='+ second +' ^callpath ^dyninst ^libelf ^libdwarf')
- self.assertRaises(spack.spec.UnsatisfiableTargetSpecError, spec.normalize)
-#endif /* not NEW */
+
+ self.set_pkg_dep('mpileaks', 'mpich target=%s' % platform.target('default_target'))
+ spec = Spec('mpileaks ^mpich target=sles_10_ppc64 ^callpath ^dyninst ^libelf ^libdwarf')
+ self.assertRaises(spack.spec.UnsatisfiableArchitectureSpecError, 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 b6c9d61293..8cdb91e206 100644
--- a/lib/spack/spack/test/spec_semantics.py
+++ b/lib/spack/spack/test/spec_semantics.py
@@ -23,6 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import unittest
+import spack.architecture
from spack.spec import *
from spack.test.mock_packages_test import *
@@ -138,23 +139,31 @@ class SpecSematicsTest(MockPackagesTest):
self.check_unsatisfiable('foo %gcc@4.7', '%gcc@4.7.3')
-#ifdef NEW
def test_satisfies_architecture(self):
- self.check_satisfies('foo arch=chaos_5_x86_64_ib', ' arch=chaos_5_x86_64_ib')
- self.check_satisfies('foo arch=bgqos_0', ' arch=bgqos_0')
+ platform = self.architecture.sys_type()
+ if platform.name == 'crayxc':
+ self.check_satisfies('foo target=frontend os=frontend', 'target=frontend os=frontend')
+ self.check_satisfies('foo target=backend os=backend', 'target=backend', 'os=backend')
+ self.check_satisfies('foo target=default_target os=default_os','target=default_target os=default_os')
- self.check_unsatisfiable('foo arch=bgqos_0', ' arch=chaos_5_x86_64_ib')
- self.check_unsatisfiable('foo arch=chaos_5_x86_64_ib', ' arch=bgqos_0')
-#else /* not NEW */
- def test_satisfies_target(self):
- platform = spack.architecture.sys_type()
- targets = platform.targets.values()
- for target in targets:
- self.check_satisfies('foo='+target.name, '='+target.name)
-#endif /* not NEW */
- for i in range(1,len(targets)):
- self.check_unsatisfiable('foo='+targets[i-1].name, '='+targets[i].name)
+#ifdef NEW
+ #def test_satisfies_architecture(self):
+ # self.check_satisfies('foo arch=chaos_5_x86_64_ib', ' arch=chaos_5_x86_64_ib')
+ # self.check_satisfies('foo arch=bgqos_0', ' arch=bgqos_0')
+
+ # self.check_unsatisfiable('foo arch=bgqos_0', ' arch=chaos_5_x86_64_ib')
+ # self.check_unsatisfiable('foo arch=chaos_5_x86_64_ib', ' arch=bgqos_0')
+#els#e /* not NEW */
+ #def test_satisfies_target(self):
+ # platform = spack.architecture.sys_type()
+ # targets = platform.targets.values()
+ # for target in targets:
+ # self.check_satisfies('foo='+target.name, '='+target.name)
+#end#if /* not NEW */
+
+ # for i in range(1,len(targets)):
+ # self.check_unsatisfiable('foo='+targets[i-1].name, '='+targets[i].name)
def test_satisfies_dependencies(self):
self.check_satisfies('mpileaks^mpich', '^mpich')
@@ -355,22 +364,29 @@ class SpecSematicsTest(MockPackagesTest):
self.check_constrain('libelf+debug~foo', 'libelf+debug', 'libelf+debug~foo')
-#ifdef NEW
def test_constrain_compiler_flags(self):
self.check_constrain('libelf cflags="-O3" cppflags="-Wall"', 'libelf cflags="-O3"', 'libelf cppflags="-Wall"')
self.check_constrain('libelf cflags="-O3" cppflags="-Wall"', 'libelf cflags="-O3"', 'libelf cflags="-O3" cppflags="-Wall"')
- def test_constrain_arch(self):
- self.check_constrain('libelf arch=bgqos_0', 'libelf arch=bgqos_0', 'libelf arch=bgqos_0')
- self.check_constrain('libelf arch=bgqos_0', 'libelf', 'libelf arch=bgqos_0')
-#else /* not NEW */
- def test_constrain_target(self):
- platform = spack.architecture.sys_type()
- target = platform.target('default_target').name
- self.check_constrain('libelf='+target, 'libelf='+target, 'libelf='+target)
- self.check_constrain('libelf='+target, 'libelf', 'libelf='+target)
-#endif /* not NEW */
+ def test_constrain_architecture(self):
+ self.check_constrain('libelf target=default_target os=default_os',
+ 'libelf target=default_target os=default_os',
+ 'libelf target=default_target os=default_os')
+ self.check_constrain('libelf target=default_target os=default_os',
+ 'libelf',
+ 'libelf target=default_target os=default_os')
+
+ #def test_constrain_arch(self):
+ # self.check_constrain('libelf arch=bgqos_0', 'libelf arch=bgqos_0', 'libelf arch=bgqos_0')
+ # self.check_constrain('libelf arch=bgqos_0', 'libelf', 'libelf arch=bgqos_0')
+#els#e /* not NEW */
+ #def test_constrain_target(self):
+ # platform = spack.architecture.sys_type()
+ # target = platform.target('default_target').name
+ # self.check_constrain('libelf='+target, 'libelf='+target, 'libelf='+target)
+ # self.check_constrain('libelf='+target, 'libelf', 'libelf='+target)
+#end#if /* not NEW */
def test_constrain_compiler(self):
@@ -384,20 +400,11 @@ class SpecSematicsTest(MockPackagesTest):
self.check_invalid_constraint('libelf+debug', 'libelf~debug')
self.check_invalid_constraint('libelf+debug~foo', 'libelf+debug+foo')
-#ifdef NEW
self.check_invalid_constraint('libelf debug=2', 'libelf debug=1')
self.check_invalid_constraint('libelf cppflags="-O3"', 'libelf cppflags="-O2"')
-
- self.check_invalid_constraint('libelf arch=bgqos_0', 'libelf arch=x86_54')
-#else /* not NEW */
-
- platform = spack.architecture.sys_type()
- targets = platform.targets.values()
- if len(targets) > 1:
- self.check_invalid_constraint('libelf='+targets[0].name, 'libelf='+targets[1].name)
-#endif /* not NEW */
-
+ self.check_invalid_constraint('libelf target=default_target os=default_os',
+ 'libelf target=x86_64 os=ubuntu')
def test_constrain_changed(self):
self.check_constrain_changed('libelf', '@1.0')
@@ -406,14 +413,13 @@ class SpecSematicsTest(MockPackagesTest):
self.check_constrain_changed('libelf%gcc', '%gcc@4.5')
self.check_constrain_changed('libelf', '+debug')
self.check_constrain_changed('libelf', '~debug')
-#ifdef NEW
self.check_constrain_changed('libelf', 'debug=2')
self.check_constrain_changed('libelf', 'cppflags="-O3"')
self.check_constrain_changed('libelf', ' arch=bgqos_0')
-#else /* not NEW */
+
platform = spack.architecture.sys_type()
- self.check_constrain_changed('libelf', '='+platform.target('default_target').name)
-#endif /* not NEW */
+ self.check_constrain_changed('libelf', 'target='+platform.target('default_target').name)
+ self.check_constrain_changed('libelf', 'os='+platform.operating_system('default_os').name)
def test_constrain_not_changed(self):
@@ -424,17 +430,12 @@ class SpecSematicsTest(MockPackagesTest):
self.check_constrain_not_changed('libelf%gcc@4.5', '%gcc@4.5')
self.check_constrain_not_changed('libelf+debug', '+debug')
self.check_constrain_not_changed('libelf~debug', '~debug')
-#ifdef NEW
self.check_constrain_not_changed('libelf debug=2', 'debug=2')
self.check_constrain_not_changed('libelf cppflags="-O3"', 'cppflags="-O3"')
- self.check_constrain_not_changed('libelf arch=bgqos_0', ' arch=bgqos_0')
-#else /* not NEW */
+
platform = spack.architecture.sys_type()
default_target = platform.target('default_target').name
- self.check_constrain_not_changed('libelf='+default_target, '='+default_target)
-#endif /* not NEW */
- self.check_constrain_not_changed('libelf^foo', 'libelf^foo')
- self.check_constrain_not_changed('libelf^foo^bar', 'libelf^foo^bar')
+ self.check_constrain_not_changed('libelf target='+default_target, 'target='+default_target)
def test_constrain_dependency_changed(self):
@@ -444,14 +445,9 @@ class SpecSematicsTest(MockPackagesTest):
self.check_constrain_changed('libelf^foo%gcc', 'libelf^foo%gcc@4.5')
self.check_constrain_changed('libelf^foo', 'libelf^foo+debug')
self.check_constrain_changed('libelf^foo', 'libelf^foo~debug')
-#ifdef NEW
- self.check_constrain_changed('libelf^foo', 'libelf^foo cppflags="-O3"')
- self.check_constrain_changed('libelf^foo', 'libelf^foo arch=bgqos_0')
-#else /* not NEW */
platform = spack.architecture.sys_type()
default_target = platform.target('default_target').name
- self.check_constrain_changed('libelf^foo', 'libelf^foo='+default_target)
-#endif /* not NEW */
+ self.check_constrain_changed('libelf^foo', 'libelf^foo target='+default_target)
def test_constrain_dependency_not_changed(self):
@@ -461,13 +457,8 @@ class SpecSematicsTest(MockPackagesTest):
self.check_constrain_not_changed('libelf^foo%gcc@4.5', 'libelf^foo%gcc@4.5')
self.check_constrain_not_changed('libelf^foo+debug', 'libelf^foo+debug')
self.check_constrain_not_changed('libelf^foo~debug', 'libelf^foo~debug')
-#ifdef NEW
self.check_constrain_not_changed('libelf^foo cppflags="-O3"', 'libelf^foo cppflags="-O3"')
- self.check_constrain_not_changed('libelf^foo arch=bgqos_0', 'libelf^foo arch=bgqos_0')
-#else /* not NEW */
platform = spack.architecture.sys_type()
default_target = platform.target('default_target').name
- self.check_constrain_not_changed('libelf^foo='+default_target, 'libelf^foo='+default_target)
-
-#endif /* not NEW */
+ self.check_constrain_not_changed('libelf^foo target='+default_target, 'libelf^foo target='+default_target)