summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarmen Stoppels <me@harmenstoppels.nl>2023-11-01 09:14:37 +0100
committerGitHub <noreply@github.com>2023-11-01 09:14:37 +0100
commit2ea8e6c820e78c08c5b5265056fb292511de9c04 (patch)
treeec8a66dc19f5f8a9c9f3c0414d7051ec83caccc6
parentac976a4bf42d475328f26f34e70bf1317fc0bdec (diff)
downloadspack-2ea8e6c820e78c08c5b5265056fb292511de9c04.tar.gz
spack-2ea8e6c820e78c08c5b5265056fb292511de9c04.tar.bz2
spack-2ea8e6c820e78c08c5b5265056fb292511de9c04.tar.xz
spack-2ea8e6c820e78c08c5b5265056fb292511de9c04.zip
Executable.add_default_arg: multiple (#40801)
-rw-r--r--lib/spack/spack/fetch_strategy.py3
-rw-r--r--lib/spack/spack/util/executable.py6
-rw-r--r--lib/spack/spack/util/git.py3
-rw-r--r--var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py3
-rw-r--r--var/spack/repos/builtin/packages/py-installer/package.py3
-rw-r--r--var/spack/repos/builtin/packages/py-pip/package.py3
6 files changed, 8 insertions, 13 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index a7b3d25043..a922d9caf4 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -773,8 +773,7 @@ class GitFetchStrategy(VCSFetchStrategy):
# Disable advice for a quieter fetch
# https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.2.txt
if self.git_version >= spack.version.Version("1.7.2"):
- self._git.add_default_arg("-c")
- self._git.add_default_arg("advice.detachedHead=false")
+ self._git.add_default_arg("-c", "advice.detachedHead=false")
# If the user asked for insecure fetching, make that work
# with git as well.
diff --git a/lib/spack/spack/util/executable.py b/lib/spack/spack/util/executable.py
index 48dca0ffa3..3aea141d87 100644
--- a/lib/spack/spack/util/executable.py
+++ b/lib/spack/spack/util/executable.py
@@ -35,9 +35,9 @@ class Executable:
if not self.exe:
raise ProcessError("Cannot construct executable for '%s'" % name)
- def add_default_arg(self, arg):
- """Add a default argument to the command."""
- self.exe.append(arg)
+ def add_default_arg(self, *args):
+ """Add default argument(s) to the command."""
+ self.exe.extend(args)
def add_default_env(self, key, value):
"""Set an environment variable when the command is run.
diff --git a/lib/spack/spack/util/git.py b/lib/spack/spack/util/git.py
index ceb0013412..39efdda9c3 100644
--- a/lib/spack/spack/util/git.py
+++ b/lib/spack/spack/util/git.py
@@ -24,7 +24,6 @@ def git(required: bool = False):
# If we're running under pytest, add this to ignore the fix for CVE-2022-39253 in
# git 2.38.1+. Do this in one place; we need git to do this in all parts of Spack.
if git and "pytest" in sys.modules:
- git.add_default_arg("-c")
- git.add_default_arg("protocol.file.allow=always")
+ git.add_default_arg("-c", "protocol.file.allow=always")
return git
diff --git a/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py b/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py
index 5545053cc8..84b65a5761 100644
--- a/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py
+++ b/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py
@@ -226,8 +226,7 @@ class IntelOneapiCompilers(IntelOneApiPackage):
def inject_rpaths(self):
# Sets rpath so the compilers can work without setting LD_LIBRARY_PATH.
patchelf = which("patchelf")
- patchelf.add_default_arg("--set-rpath")
- patchelf.add_default_arg(":".join(self._ld_library_path()))
+ patchelf.add_default_arg("--set-rpath", ":".join(self._ld_library_path()))
for pd in ["bin", "lib", join_path("compiler", "lib", "intel64_lin")]:
for file in find(self.component_prefix.linux.join(pd), "*", recursive=False):
# Try to patch all files, patchelf will do nothing and fail if file
diff --git a/var/spack/repos/builtin/packages/py-installer/package.py b/var/spack/repos/builtin/packages/py-installer/package.py
index 30a4a62072..1bedecf074 100644
--- a/var/spack/repos/builtin/packages/py-installer/package.py
+++ b/var/spack/repos/builtin/packages/py-installer/package.py
@@ -40,6 +40,5 @@ class PyInstaller(Package, PythonExtension):
def setup_dependent_package(self, module, dependent_spec):
installer = dependent_spec["python"].command
- installer.add_default_arg("-m")
- installer.add_default_arg("installer")
+ installer.add_default_arg("-m", "installer")
setattr(module, "installer", installer)
diff --git a/var/spack/repos/builtin/packages/py-pip/package.py b/var/spack/repos/builtin/packages/py-pip/package.py
index dfa85d55bc..d92a53671e 100644
--- a/var/spack/repos/builtin/packages/py-pip/package.py
+++ b/var/spack/repos/builtin/packages/py-pip/package.py
@@ -110,6 +110,5 @@ class PyPip(Package, PythonExtension):
def setup_dependent_package(self, module, dependent_spec):
pip = dependent_spec["python"].command
- pip.add_default_arg("-m")
- pip.add_default_arg("pip")
+ pip.add_default_arg("-m", "pip")
setattr(module, "pip", pip)