bugfix: include configuration ignoring files with the same basename (#18487)
* Use the config path instead of the basename * Removing unused variables Co-authored-by: Greg Becker <becker33@llnl.gov> * Test Making sure if there are 2 include config files with the same basename they are both implemented * Edit test assert Co-authored-by: Greg Becker <becker33@llnl.gov>
This commit is contained in:
parent
afb0883762
commit
8116153f2a
2 changed files with 43 additions and 2 deletions
|
@ -829,8 +829,7 @@ def included_config_scopes(self):
|
||||||
scope = spack.config.ConfigScope(config_name, config_path)
|
scope = spack.config.ConfigScope(config_name, config_path)
|
||||||
elif os.path.exists(config_path):
|
elif os.path.exists(config_path):
|
||||||
# files are assumed to be SingleFileScopes
|
# files are assumed to be SingleFileScopes
|
||||||
base, ext = os.path.splitext(os.path.basename(config_path))
|
config_name = 'env:%s:%s' % (self.name, config_path)
|
||||||
config_name = 'env:%s:%s' % (self.name, base)
|
|
||||||
scope = spack.config.SingleFileScope(
|
scope = spack.config.SingleFileScope(
|
||||||
config_name, config_path, spack.schema.merged.schema)
|
config_name, config_path, spack.schema.merged.schema)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -547,6 +547,48 @@ def test_with_config_bad_include(env_deactivate, capfd):
|
||||||
assert 'no/such/file.yaml' in err
|
assert 'no/such/file.yaml' in err
|
||||||
|
|
||||||
|
|
||||||
|
def test_env_with_include_config_files_same_basename():
|
||||||
|
test_config = """\
|
||||||
|
env:
|
||||||
|
include:
|
||||||
|
- ./path/to/included-config.yaml
|
||||||
|
- ./second/path/to/include-config.yaml
|
||||||
|
specs:
|
||||||
|
[libelf, mpileaks]
|
||||||
|
"""
|
||||||
|
|
||||||
|
_env_create('test', StringIO(test_config))
|
||||||
|
e = ev.read('test')
|
||||||
|
|
||||||
|
fs.mkdirp(os.path.join(e.path, 'path', 'to'))
|
||||||
|
with open(os.path.join(
|
||||||
|
e.path,
|
||||||
|
'./path/to/included-config.yaml'), 'w') as f:
|
||||||
|
f.write("""\
|
||||||
|
packages:
|
||||||
|
libelf:
|
||||||
|
version: [0.8.10]
|
||||||
|
""")
|
||||||
|
|
||||||
|
fs.mkdirp(os.path.join(e.path, 'second', 'path', 'to'))
|
||||||
|
with open(os.path.join(
|
||||||
|
e.path,
|
||||||
|
'./second/path/to/include-config.yaml'), 'w') as f:
|
||||||
|
f.write("""\
|
||||||
|
packages:
|
||||||
|
mpileaks:
|
||||||
|
version: [2.2]
|
||||||
|
""")
|
||||||
|
|
||||||
|
with e:
|
||||||
|
e.concretize()
|
||||||
|
|
||||||
|
environment_specs = e._get_environment_specs(False)
|
||||||
|
|
||||||
|
assert(environment_specs[0].satisfies('libelf@0.8.10'))
|
||||||
|
assert(environment_specs[1].satisfies('mpileaks@2.2'))
|
||||||
|
|
||||||
|
|
||||||
def test_env_with_included_config_file():
|
def test_env_with_included_config_file():
|
||||||
test_config = """\
|
test_config = """\
|
||||||
env:
|
env:
|
||||||
|
|
Loading…
Reference in a new issue