Avoid trailing slashes in strings (#48359)

This commit is contained in:
Adam J. Stewart
2025-01-03 23:00:18 +01:00
committed by GitHub
parent 7f9019c1ca
commit 0a03a92e78
39 changed files with 128 additions and 183 deletions

View File

@@ -548,10 +548,9 @@ def ensure_winsdk_external_or_raise() -> None:
missing_packages_lst.append("win-sdk")
missing_packages = " & ".join(missing_packages_lst)
raise RuntimeError(
f"Unable to find the {missing_packages}, please install these packages \
via the Visual Studio installer \
before proceeding with Spack or provide the path to a non standard install with \
'spack external find --path'"
f"Unable to find the {missing_packages}, please install these packages via the Visual "
"Studio installer before proceeding with Spack or provide the path to a non standard "
"install with 'spack external find --path'"
)
# wgl/sdk are not required for bootstrapping Spack, but
# are required for building anything non trivial

View File

@@ -232,8 +232,10 @@ def build_name(self, spec: Optional[spack.spec.Spec] = None) -> Optional[str]:
Returns: (str) given spec's CDash build name."""
if spec:
build_name = f"{spec.name}@{spec.version}%{spec.compiler} \
hash={spec.dag_hash()} arch={spec.architecture} ({self.build_group})"
build_name = (
f"{spec.name}@{spec.version}%{spec.compiler} "
f"hash={spec.dag_hash()} arch={spec.architecture} ({self.build_group})"
)
tty.debug(f"Generated CDash build name ({build_name}) from the {spec.name}")
return build_name

View File

@@ -279,8 +279,10 @@ def test_add_config_path(mutable_config):
assert "gcc" in compilers
# Try quotes to escape brackets
path = "config:install_tree:projections:cmake:\
'{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}'"
path = (
"config:install_tree:projections:cmake:"
"'{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}'"
)
spack.config.add(path)
set_value = spack.config.get("config")["install_tree"]["projections"]["cmake"]
assert set_value == "{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}"

View File

@@ -1173,8 +1173,8 @@ def test_parse_specfile_dependency(default_mock_concretization, tmpdir):
# Should also be accepted: "spack spec ../<cur-dir>/libelf.yaml"
spec = SpecParser(
f"libdwarf^..{os.path.sep}{specfile.dirpath().basename}\
{os.path.sep}{specfile.basename}"
f"libdwarf^..{os.path.sep}{specfile.dirpath().basename}"
f"{os.path.sep}{specfile.basename}"
).next_spec()
assert spec["libelf"] == s["libelf"]

View File

@@ -259,8 +259,7 @@ def _system_7zip(archive_file):
_7z = which("7z")
if not _7z:
raise CommandNotFoundError(
"7z unavailable,\
unable to extract %s files. 7z can be installed via Spack"
"7z unavailable, unable to extract %s files. 7z can be installed via Spack"
% llnl.url.extension_from_path(archive_file)
)
_7z.add_default_arg("e")