Changed spec syntax for new parts from modules feature
This commit is contained in:
parent
2e1810e3a7
commit
45bf93405a
4 changed files with 11 additions and 12 deletions
|
@ -168,7 +168,7 @@ def parse_config_options(module_generator):
|
|||
# Get the configuration for this kind of generator
|
||||
module_configuration = copy.deepcopy(CONFIGURATION.get(
|
||||
module_generator.name, {}))
|
||||
|
||||
print module_configuration
|
||||
#####
|
||||
# Merge all the rules
|
||||
#####
|
||||
|
|
|
@ -146,12 +146,12 @@ class SomePackage(Package):
|
|||
def install(self, prefix):
|
||||
# Do default install
|
||||
|
||||
@when('=chaos_5_x86_64_ib')
|
||||
@when('arch=chaos_5_x86_64_ib')
|
||||
def install(self, prefix):
|
||||
# This will be executed instead of the default install if
|
||||
# the package's sys_type() is chaos_5_x86_64_ib.
|
||||
|
||||
@when('=bgqos_0")
|
||||
@when('arch=bgqos_0")
|
||||
def install(self, prefix):
|
||||
# This will be executed if the package's sys_type is bgqos_0
|
||||
|
||||
|
|
|
@ -2294,7 +2294,6 @@ def parse_anonymous_spec(spec_like, pkg_name):
|
|||
try:
|
||||
anon_spec = Spec(spec_like)
|
||||
if anon_spec.name != pkg_name:
|
||||
print anon_spec.name, pkg_name
|
||||
raise SpecParseError(spack.parse.ParseError("","","Expected anonymous spec for package %s but found spec for package %s" % (pkg_name, anon_spec.name) ))
|
||||
except SpecParseError:
|
||||
anon_spec = Spec(pkg_name + ' ' + spec_like)
|
||||
|
|
|
@ -49,7 +49,7 @@ def mock_open(filename, mode):
|
|||
'all': {
|
||||
'filter': {'environment_blacklist': ['CMAKE_PREFIX_PATH']}
|
||||
},
|
||||
'=x86-linux': {
|
||||
'arch=x86-linux': {
|
||||
'environment': {'set': {'FOO': 'foo'},
|
||||
'unset': ['BAR']}
|
||||
}
|
||||
|
@ -99,26 +99,26 @@ def get_modulefile_content(self, spec):
|
|||
|
||||
def test_simple_case(self):
|
||||
spack.modules.CONFIGURATION = configuration_autoload_direct
|
||||
spec = spack.spec.Spec('mpich@3.0.4=x86-linux')
|
||||
spec = spack.spec.Spec('mpich@3.0.4 arch=x86-linux')
|
||||
content = self.get_modulefile_content(spec)
|
||||
self.assertTrue('module-whatis "mpich @3.0.4"' in content)
|
||||
|
||||
def test_autoload(self):
|
||||
spack.modules.CONFIGURATION = configuration_autoload_direct
|
||||
spec = spack.spec.Spec('mpileaks=x86-linux')
|
||||
spec = spack.spec.Spec('mpileaks arch=x86-linux')
|
||||
content = self.get_modulefile_content(spec)
|
||||
self.assertEqual(len([x for x in content if 'is-loaded' in x]), 2)
|
||||
self.assertEqual(len([x for x in content if 'module load ' in x]), 2)
|
||||
|
||||
spack.modules.CONFIGURATION = configuration_autoload_all
|
||||
spec = spack.spec.Spec('mpileaks=x86-linux')
|
||||
spec = spack.spec.Spec('mpileaks arch=x86-linux')
|
||||
content = self.get_modulefile_content(spec)
|
||||
self.assertEqual(len([x for x in content if 'is-loaded' in x]), 5)
|
||||
self.assertEqual(len([x for x in content if 'module load ' in x]), 5)
|
||||
|
||||
def test_alter_environment(self):
|
||||
spack.modules.CONFIGURATION = configuration_alter_environment
|
||||
spec = spack.spec.Spec('mpileaks=x86-linux')
|
||||
spec = spack.spec.Spec('mpileaks arch=x86-linux')
|
||||
content = self.get_modulefile_content(spec)
|
||||
self.assertEqual(
|
||||
len([x
|
||||
|
@ -128,7 +128,7 @@ def test_alter_environment(self):
|
|||
len([x for x in content if 'setenv FOO "foo"' in x]), 1)
|
||||
self.assertEqual(len([x for x in content if 'unsetenv BAR' in x]), 1)
|
||||
|
||||
spec = spack.spec.Spec('libdwarf=x64-linux')
|
||||
spec = spack.spec.Spec('libdwarf arch=x64-linux')
|
||||
content = self.get_modulefile_content(spec)
|
||||
self.assertEqual(
|
||||
len([x
|
||||
|
@ -140,14 +140,14 @@ def test_alter_environment(self):
|
|||
|
||||
def test_blacklist(self):
|
||||
spack.modules.CONFIGURATION = configuration_blacklist
|
||||
spec = spack.spec.Spec('mpileaks=x86-linux')
|
||||
spec = spack.spec.Spec('mpileaks arch=x86-linux')
|
||||
content = self.get_modulefile_content(spec)
|
||||
self.assertEqual(len([x for x in content if 'is-loaded' in x]), 1)
|
||||
self.assertEqual(len([x for x in content if 'module load ' in x]), 1)
|
||||
|
||||
def test_conflicts(self):
|
||||
spack.modules.CONFIGURATION = configuration_conflicts
|
||||
spec = spack.spec.Spec('mpileaks=x86-linux')
|
||||
spec = spack.spec.Spec('mpileaks arch=x86-linux')
|
||||
content = self.get_modulefile_content(spec)
|
||||
self.assertEqual(
|
||||
len([x for x in content if x.startswith('conflict')]), 2)
|
||||
|
|
Loading…
Reference in a new issue