Skip to content

Commit

Permalink
Avoid trailing slashes in strings
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstewart committed Jan 2, 2025
1 parent f635337 commit e1080ed
Show file tree
Hide file tree
Showing 39 changed files with 128 additions and 183 deletions.
7 changes: 3 additions & 4 deletions lib/spack/spack/bootstrap/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions lib/spack/spack/ci/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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} "
"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

Expand Down
6 changes: 4 additions & 2 deletions lib/spack/spack/test/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
4 changes: 2 additions & 2 deletions lib/spack/spack/test/spec_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
"{os.path.sep}{specfile.basename}"
).next_spec()
assert spec["libelf"] == s["libelf"]

Expand Down
3 changes: 1 addition & 2 deletions lib/spack/spack/util/compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
38 changes: 18 additions & 20 deletions var/spack/repos/builtin/packages/abacus/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,24 @@ def edit(self, spec, prefix):
inc_var = "-"
system_var = "ELPA_LIB = -L${ELPA_LIB_DIR} -lelpa -Wl,-rpath=${ELPA_LIB_DIR}"

tempInc = (
"\
FORTRAN = ifort\n\
CPLUSPLUS = icpc\n\
CPLUSPLUS_MPI = mpiicpc\n\
LAPACK_DIR = $(MKLROOT)\n\
FFTW_DIR = %s\n\
ELPA_DIR = %s\n\
ELPA_INCLUDE = -I${ELPA_DIR}/include/elpa%s%s\n\
CEREAL_DIR = %s\n\
OBJ_DIR = obj\n\
OBJ_DIR_serial = obj\n\
NP = 14\n"
% (
spec["fftw"].prefix,
spec["elpa"].prefix,
inc_var,
f"{spec['elpa'].version}",
spec["cereal"].prefix,
)
tempInc = """
FORTRAN = ifort
CPLUSPLUS = icpc
CPLUSPLUS_MPI = mpiicpc
LAPACK_DIR = $(MKLROOT)
FFTW_DIR = %s
ELPA_DIR = %s
ELPA_INCLUDE = -I${ELPA_DIR}/include/elpa%s%s
CEREAL_DIR = %s
OBJ_DIR = obj
OBJ_DIR_serial = obj
NP = 14
""" % (
spec["fftw"].prefix,
spec["elpa"].prefix,
inc_var,
f"{spec['elpa'].version}",
spec["cereal"].prefix,
)

with open(self.build_directory + "/Makefile.vars", "w") as f:
Expand Down
4 changes: 2 additions & 2 deletions var/spack/repos/builtin/packages/axl/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ class Axl(CMakePackage):
variant(
"bbapi_fallback",
default=False,
description="Using BBAPI, if source or destination don't support \
file extents then fallback to pthreads",
description="Using BBAPI, if source or destination don't support "
"file extents then fallback to pthreads",
)

variant("dw", default=False, description="Enable Cray DataWarp support")
Expand Down
32 changes: 12 additions & 20 deletions var/spack/repos/builtin/packages/babelstream/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,14 @@ class Babelstream(CMakePackage, CudaPackage, ROCmPackage, MakefilePackage):
values=("cuda", "rocm"),
default="cuda",
when="+thrust",
description="Which THRUST implementation to use, supported options include option= \
- CUDA (via https://github.com/NVIDIA/thrust)\
- ROCM (via https://github.com/ROCmSoftwarePlatform/rocThrust)",
description="Which THRUST implementation to use",
)
variant(
"thrust_backend",
values=("cuda", "omp", "tbb"),
default="cuda",
when="+thrust",
description="Which THRUST implementation to use, supported options include option",
description="Which THRUST implementation to use",
)

# Kokkos variant
Expand Down Expand Up @@ -146,8 +144,8 @@ class Babelstream(CMakePackage, CudaPackage, ROCmPackage, MakefilePackage):
values=("nvhpc", "none"),
default="none",
when="+std",
description="Enable offloading support (via the non-standard `-stdpar`)\
for the new NVHPC SDK",
description="Enable offloading support (via the non-standard `-stdpar`) "
"for the new NVHPC SDK",
)
variant(
"std_onedpl_backend",
Expand All @@ -161,16 +159,16 @@ class Babelstream(CMakePackage, CudaPackage, ROCmPackage, MakefilePackage):
values=(True, False),
default=False,
when="+std",
description="No-op if ONE_TBB_DIR is set. Link against an in-tree oneTBB\
via FetchContent_Declare, see top level CMakeLists.txt for details",
description="No-op if ONE_TBB_DIR is set. Link against an in-tree oneTBB "
"via FetchContent_Declare, see top level CMakeLists.txt for details",
)
variant(
"std_use_onedpl",
values=(True, False),
default=False,
when="+std",
description="Link oneDPL which implements C++17 executor policies\
(via execution_policy_tag) for different backends",
description="Link oneDPL which implements C++17 executor policies "
"(via execution_policy_tag) for different backends",
)
# hip memory mode
variant(
Expand All @@ -186,9 +184,9 @@ class Babelstream(CMakePackage, CudaPackage, ROCmPackage, MakefilePackage):
values=(True, False),
default=False,
when="+tbb",
description="Whether to use std::vector<T> for storage or use aligned_alloc. \
C++ vectors are *zero* initialised where as aligned_alloc is \
uninitialised before first use.",
description="Whether to use std::vector<T> for storage or use aligned_alloc. "
"C++ vectors are *zero* initialised where as aligned_alloc is "
"uninitialised before first use.",
)

# Thrust Conflict
Expand All @@ -208,13 +206,7 @@ class Babelstream(CMakePackage, CudaPackage, ROCmPackage, MakefilePackage):
values=("auto", "affinity", "static", "simple"),
default="auto",
when="+tbb",
description="Partitioner specifies how a loop template should partition its work among threads.\
Possible values are:\
AUTO - Optimize range subdivision based on work-stealing events.\
AFFINITY - Proportional splitting that optimizes for cache affinity.\
STATIC - Distribute work uniformly with no additional load balancing.\
SIMPLE - Recursively split its range until it cannot be further subdivided.\
See https://spec.oneapi.com/versions/latest/elements/oneTBB/source/algorithms.html#partitioners",
description="Specifies how a loop template should partition its work among threads",
)

# Kokkos & RAJA Dependency
Expand Down
7 changes: 3 additions & 4 deletions var/spack/repos/builtin/packages/berkeleygw/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,9 @@ def edit(self, spec, prefix):
# use parallelization in tests
filter_file(
r"cd testsuite \&\& \$\(MAKE\) check$",
"cd testsuite && export BGW_TEST_MPI_NPROCS=2 OMP_NUM_THREADS=2 \
SAVETESTDIRS=yes TEMPDIRPATH=%s && \
$(MAKE) check-parallel"
% join_path(self.build_directory, "tmp"),
"cd testsuite && export BGW_TEST_MPI_NPROCS=2 OMP_NUM_THREADS=2 "
"SAVETESTDIRS=yes TEMPDIRPATH=%s && "
"$(MAKE) check-parallel" % join_path(self.build_directory, "tmp"),
"Makefile",
)

Expand Down
3 changes: 1 addition & 2 deletions var/spack/repos/builtin/packages/breakdancer/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ def setup_run_environment(self, env):
def edit(self):
# perl tools end up in a silly lib subdirectory, fixing that
filter_file(
r"set\(SUPPORT_LIBDIR lib\/breakdancer-max\$ \
\{EXE_VERSION_SUFFIX\}\)",
r"set\(SUPPORT_LIBDIR lib\/breakdancer-max\$ \{EXE_VERSION_SUFFIX\}\)",
"set(SUPPORT_LIBDIR lib)",
join_path(self.stage.source_path, "perl", "CMakeLists.txt"),
)
3 changes: 1 addition & 2 deletions var/spack/repos/builtin/packages/cbtf-argonavis/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class CbtfArgonavis(CMakePackage):
variant(
"crayfe",
default=False,
description="build only the FE tool using the runtime_dir \
to point to target build.",
description="build only the FE tool using the runtime_dir to point to target build.",
)
variant(
"runtime", default=False, description="build only the runtime libraries and collectors."
Expand Down
3 changes: 1 addition & 2 deletions var/spack/repos/builtin/packages/cbtf-krell/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class CbtfKrell(CMakePackage):
variant(
"crayfe",
default=False,
description="build only the FE tool using the runtime_dir \
to point to target build.",
description="build only the FE tool using the runtime_dir to point to target build.",
)

# Dependencies for cbtf-krell
Expand Down
16 changes: 5 additions & 11 deletions var/spack/repos/builtin/packages/charmpp/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,7 @@ def install(self, spec, prefix):
if not ("backend=mpi" in self.spec) or not ("backend=netlrts" in self.spec):
if self.spec.satisfies("+pthreads"):
raise InstallError(
"The pthreads option is only\
available on the Netlrts and MPI \
network layers."
"The pthreads option is only available on the Netlrts and MPI network layers."
)

if (
Expand All @@ -290,10 +288,8 @@ def install(self, spec, prefix):
):
if self.spec.satisfies("pmi=none"):
raise InstallError(
"The UCX/OFI/GNI backends need \
PMI to run. Please add pmi=... \
Note that PMIx is the preferred \
option."
"The UCX/OFI/GNI backends need PMI to run. Please add pmi=... "
"Note that PMIx is the preferred option."
)

if (
Expand All @@ -303,10 +299,8 @@ def install(self, spec, prefix):
):
if self.spec.satisfies("^openmpi"):
raise InstallError(
"To use any process management \
interface other than PMIx, \
a non OpenMPI based MPI must be \
present on the system"
"To use any process management interface other than PMIx, "
"a non OpenMPI based MPI must be present on the system"
)

target = spec.variants["build-target"].value
Expand Down
9 changes: 4 additions & 5 deletions var/spack/repos/builtin/packages/flamemaster/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,10 @@ def cmake_args(self):
]
)
if self.spec.satisfies("%icc"):
cxxflags = "-Ofast -ffast-math -DNDEBUG -march=native\
-mtune=native -funroll-all-loops\
-qopt-multi-version-aggressive -ipo -parallel"
cflags = "-Ofast -ffast-math -DNDEBUG -march=native\
-mtune=native -funroll-all-loops -ipo -parallel"
cxxflags = "-Ofast -ffast-math -DNDEBUG -march=native -mtune=native "
cxxflags += "-funroll-all-loops -qopt-multi-version-aggressive -ipo -parallel"
cflags = "-Ofast -ffast-math -DNDEBUG -march=native -mtune=native "
cflags += "-funroll-all-loops -ipo -parallel"
fcflags = "-Ofast -march=native -mtune=native -ipo -parallel"
args.extend(
[
Expand Down
4 changes: 2 additions & 2 deletions var/spack/repos/builtin/packages/fujitsu-ssl2/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class FujitsuSsl2(Package):

def install(self, spec, prefix):
raise InstallError(
"Fujitsu SSL2 is not installable; it is vendor supplied \
You need to specify it as an external package in packages.yaml"
"Fujitsu SSL2 is not installable; it is vendor supplied "
"You need to specify it as an external package in packages.yaml"
)

@property
Expand Down
3 changes: 1 addition & 2 deletions var/spack/repos/builtin/packages/fxt/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ def autoreconf(self, spec, prefix):
subprocess.check_call("./autogen.sh")
else:
raise RuntimeError(
"Neither configure nor autogen.sh script exist.\
FxT Cannot configure."
"Neither configure nor autogen.sh script exist. FxT Cannot configure."
)

def configure_args(self):
Expand Down
3 changes: 1 addition & 2 deletions var/spack/repos/builtin/packages/graphblast/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ class Graphblast(MakefilePackage, CudaPackage):
conflicts(
"cuda_arch=none",
when="+cuda",
msg='Must specify CUDA compute capabilities of your GPU. \
See "spack info graphblast"',
msg='Must specify CUDA compute capabilities of your GPU. See "spack info graphblast"',
)

def install(self, spec, prefix):
Expand Down
3 changes: 1 addition & 2 deletions var/spack/repos/builtin/packages/gunrock/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ class Gunrock(CMakePackage, CudaPackage):
conflicts(
"cuda_arch=none",
when="+cuda",
msg='Must specify CUDA compute capabilities of your GPU. \
See "spack info gunrock"',
msg='Must specify CUDA compute capabilities of your GPU. See "spack info gunrock"',
)

def cmake_args(self):
Expand Down
3 changes: 1 addition & 2 deletions var/spack/repos/builtin/packages/hermes-shm/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ class HermesShm(CMakePackage):
depends_on("[email protected]", when="+mochi")
depends_on("cereal", when="+cereal")
depends_on(
"[email protected]: +context +fiber +coroutine +regex +system \
+filesystem +serialization +pic +math",
"[email protected]:+context+fiber+coroutine+regex+system+filesystem+serialization+pic+math",
when="+boost",
)
depends_on("mpi", when="+mpiio")
Expand Down
7 changes: 5 additions & 2 deletions var/spack/repos/builtin/packages/isaac-server/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ class IsaacServer(CMakePackage):

depends_on("cxx", type="build") # generated

# variant('gstreamer', default=False, description= \
# 'Support for RTP streams, e.g. to Twitch or Youtube')
# variant(
# "gstreamer",
# default=False,
# description="Support for RTP streams, e.g. to Twitch or Youtube"
# )

depends_on("[email protected]:", type="build")
depends_on("jpeg", type="link")
Expand Down
5 changes: 1 addition & 4 deletions var/spack/repos/builtin/packages/likwid/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,7 @@ def install(self, spec, prefix):
supported_compilers = {"gcc": "GCCPOWER"}
if self.compiler.name not in supported_compilers:
raise RuntimeError(
"{0} is not a supported compiler \
to compile Likwid".format(
self.compiler.name
)
"{0} is not a supported compiler to compile Likwid".format(self.compiler.name)
)

filter_file(
Expand Down
3 changes: 1 addition & 2 deletions var/spack/repos/builtin/packages/llvm-openmp-ompt/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class LlvmOpenmpOmpt(CMakePackage):
variant(
"standalone",
default=False,
description="Build llvm openmpi ompt library as a \
stand alone entity.",
description="Build llvm openmpi ompt library as a stand alone entity.",
)
# variant for building libomptarget
variant(
Expand Down
Loading

0 comments on commit e1080ed

Please sign in to comment.