warn about removal of deprecated format strings (#34101)
* warn about removal of deprecated format strings Co-authored-by: becker33 <becker33@users.noreply.github.com>
This commit is contained in:
parent
523c4c2b63
commit
451e3ff50b
6 changed files with 19 additions and 7 deletions
|
@ -19,7 +19,7 @@ config:
|
||||||
install_tree:
|
install_tree:
|
||||||
root: $spack/opt/spack
|
root: $spack/opt/spack
|
||||||
projections:
|
projections:
|
||||||
all: "${ARCHITECTURE}/${COMPILERNAME}-${COMPILERVER}/${PACKAGE}-${VERSION}-${HASH}"
|
all: "{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}"
|
||||||
# install_tree can include an optional padded length (int or boolean)
|
# install_tree can include an optional padded length (int or boolean)
|
||||||
# default is False (do not pad)
|
# default is False (do not pad)
|
||||||
# if padded_length is True, Spack will pad as close to the system max path
|
# if padded_length is True, Spack will pad as close to the system max path
|
||||||
|
@ -219,4 +219,3 @@ config:
|
||||||
flags:
|
flags:
|
||||||
# Whether to keep -Werror flags active in package builds.
|
# Whether to keep -Werror flags active in package builds.
|
||||||
keep_werror: 'none'
|
keep_werror: 'none'
|
||||||
|
|
||||||
|
|
|
@ -4332,7 +4332,9 @@ def write_attribute(spec, attribute, color):
|
||||||
attribute += c
|
attribute += c
|
||||||
else:
|
else:
|
||||||
if c == "}":
|
if c == "}":
|
||||||
raise SpecFormatStringError("Encountered closing } before opening {")
|
raise SpecFormatStringError(
|
||||||
|
"Encountered closing } before opening { in %s" % format_string
|
||||||
|
)
|
||||||
elif c == "{":
|
elif c == "{":
|
||||||
in_attribute = True
|
in_attribute = True
|
||||||
else:
|
else:
|
||||||
|
@ -4418,7 +4420,10 @@ def old_format(self, format_string="$_$@$%@+$+$=", **kwargs):
|
||||||
TODO: allow, e.g., ``$6#`` to customize short hash length
|
TODO: allow, e.g., ``$6#`` to customize short hash length
|
||||||
TODO: allow, e.g., ``$//`` for full hash.
|
TODO: allow, e.g., ``$//`` for full hash.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn(
|
||||||
|
"Using the old Spec.format method."
|
||||||
|
" This method was deprecated in Spack v0.15 and will be removed in Spack v0.20"
|
||||||
|
)
|
||||||
color = kwargs.get("color", False)
|
color = kwargs.get("color", False)
|
||||||
|
|
||||||
# Dictionary of transformations for named tokens
|
# Dictionary of transformations for named tokens
|
||||||
|
|
|
@ -1254,6 +1254,13 @@ def test_user_config_path_is_default_when_env_var_is_empty(working_env):
|
||||||
assert os.path.expanduser("~%s.spack" % os.sep) == spack.paths._get_user_config_path()
|
assert os.path.expanduser("~%s.spack" % os.sep) == spack.paths._get_user_config_path()
|
||||||
|
|
||||||
|
|
||||||
|
def test_default_install_tree(monkeypatch):
|
||||||
|
s = spack.spec.Spec("nonexistent@x.y.z %none@a.b.c arch=foo-bar-baz")
|
||||||
|
monkeypatch.setattr(s, "dag_hash", lambda: "abc123")
|
||||||
|
projection = spack.config.get("config:install_tree:projections:all", scope="defaults")
|
||||||
|
assert s.format(projection) == "foo-bar-baz/none-a.b.c/nonexistent-x.y.z-abc123"
|
||||||
|
|
||||||
|
|
||||||
def test_local_config_can_be_disabled(working_env):
|
def test_local_config_can_be_disabled(working_env):
|
||||||
os.environ["SPACK_DISABLE_LOCAL_CONFIG"] = "true"
|
os.environ["SPACK_DISABLE_LOCAL_CONFIG"] = "true"
|
||||||
cfg = spack.config._config()
|
cfg = spack.config._config()
|
||||||
|
|
|
@ -59,7 +59,7 @@ def test_yaml_directory_layout_parameters(tmpdir, default_mock_concretization):
|
||||||
arch_scheme = (
|
arch_scheme = (
|
||||||
"{architecture.platform}/{architecture.target}/{architecture.os}/{name}/{version}/{hash:7}"
|
"{architecture.platform}/{architecture.target}/{architecture.os}/{name}/{version}/{hash:7}"
|
||||||
)
|
)
|
||||||
ns_scheme = "${ARCHITECTURE}/${NAMESPACE}/${PACKAGE}-${VERSION}-${HASH:7}"
|
ns_scheme = "{architecture}/{namespace}/{name}-{version}-{hash:7}"
|
||||||
arch_ns_scheme_projections = {"all": arch_scheme, "python": ns_scheme}
|
arch_ns_scheme_projections = {"all": arch_scheme, "python": ns_scheme}
|
||||||
layout_arch_ns = DirectoryLayout(str(tmpdir), projections=arch_ns_scheme_projections)
|
layout_arch_ns = DirectoryLayout(str(tmpdir), projections=arch_ns_scheme_projections)
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,7 @@ def get_file_lines(filename):
|
||||||
if match:
|
if match:
|
||||||
filename, line, key, val = match.groups()
|
filename, line, key, val = match.groups()
|
||||||
line = int(line)
|
line = int(line)
|
||||||
|
val = val.strip("'\"")
|
||||||
|
|
||||||
if val.lower() in ("true", "false"):
|
if val.lower() in ("true", "false"):
|
||||||
val = val.lower()
|
val = val.lower()
|
||||||
|
|
|
@ -3,6 +3,6 @@ config:
|
||||||
install_tree:
|
install_tree:
|
||||||
root: $spack\opt\spack
|
root: $spack\opt\spack
|
||||||
projections:
|
projections:
|
||||||
all: '${ARCHITECTURE}\${COMPILERNAME}-${COMPILERVER}\${PACKAGE}-${VERSION}-${HASH}'
|
all: '{architecture}\\{compiler.name}-{compiler.version}\\{name}-{version}-{hash}'
|
||||||
build_stage:
|
build_stage:
|
||||||
- ~/.spack/stage
|
- ~/.spack/stage
|
Loading…
Reference in a new issue