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