set code default for config:build_stage
Signed-off-by: Gregory Becker <becker33@llnl.gov>
This commit is contained in:
parent
ced6f984ea
commit
0df5b8616c
@ -176,13 +176,14 @@ def _resolve_paths(candidates):
|
||||
|
||||
# Cached stage path root
|
||||
_stage_root = None
|
||||
_default_stage_config = ["$tmpdir/$user/spack-stage", "$user_cache_path/stage"]
|
||||
|
||||
|
||||
def get_stage_root():
|
||||
global _stage_root
|
||||
|
||||
if _stage_root is None:
|
||||
candidates = spack.config.get("config:build_stage")
|
||||
candidates = spack.config.get("config:build_stage", _default_stage_config)
|
||||
if isinstance(candidates, str):
|
||||
candidates = [candidates]
|
||||
|
||||
|
@ -754,6 +754,17 @@ def test_get_stage_root_bad_path(self, clear_stage_root):
|
||||
# Make sure the cached stage path values are unchanged.
|
||||
assert spack.stage._stage_root is None
|
||||
|
||||
def test_get_stage_root_empty(self, clear_stage_root):
|
||||
# build stage set to empty by user is respected and errors
|
||||
with spack.config.override("config:build_stage::", []):
|
||||
with pytest.raises(spack.stage.StageError):
|
||||
spack.stage.get_stage_root()
|
||||
|
||||
# No build stage set (config section set to empty) uses default
|
||||
expected = spack.stage._resolve_paths(spack.stage._default_stage_config)[0]
|
||||
with spack.config.override("config::", {}):
|
||||
assert spack.stage.get_stage_root() == expected
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"path,purged",
|
||||
[
|
||||
|
Loading…
Reference in New Issue
Block a user