summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorHarmen Stoppels <me@harmenstoppels.nl>2024-09-01 11:25:51 +0200
committerGitHub <noreply@github.com>2024-09-01 11:25:51 +0200
commitf7de621d0c1d4524c3dde8baee204fb8864c1ecd (patch)
tree1f30349723f6011e588115bef79441ce2ae63632 /var
parenta5f404cff592cf173a3fa1907f1fb912657db8e4 (diff)
downloadspack-f7de621d0c1d4524c3dde8baee204fb8864c1ecd.tar.gz
spack-f7de621d0c1d4524c3dde8baee204fb8864c1ecd.tar.bz2
spack-f7de621d0c1d4524c3dde8baee204fb8864c1ecd.tar.xz
spack-f7de621d0c1d4524c3dde8baee204fb8864c1ecd.zip
Remove redundant inspect.getmodule(self) idiom in packages (#46073)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/evtgen/package.py2
-rw-r--r--var/spack/repos/builtin/packages/fjcontrib/package.py6
-rw-r--r--var/spack/repos/builtin/packages/grackle/package.py5
-rw-r--r--var/spack/repos/builtin/packages/intel-tbb/package.py14
-rw-r--r--var/spack/repos/builtin/packages/lorene/package.py5
-rw-r--r--var/spack/repos/builtin/packages/ollama/package.py8
-rw-r--r--var/spack/repos/builtin/packages/perl-bioperl/package.py8
-rw-r--r--var/spack/repos/builtin/packages/perl-io-socket-ssl/package.py6
-rw-r--r--var/spack/repos/builtin/packages/perl-net-ssleay/package.py6
-rw-r--r--var/spack/repos/builtin/packages/pexsi/package.py5
-rw-r--r--var/spack/repos/builtin/packages/wannier90/package.py3
11 files changed, 22 insertions, 46 deletions
diff --git a/var/spack/repos/builtin/packages/evtgen/package.py b/var/spack/repos/builtin/packages/evtgen/package.py
index 093f029ab8..41a44bad54 100644
--- a/var/spack/repos/builtin/packages/evtgen/package.py
+++ b/var/spack/repos/builtin/packages/evtgen/package.py
@@ -97,7 +97,7 @@ class Evtgen(CMakePackage):
options += self.configure_args()
with working_dir(self.build_directory, create=True):
- inspect.getmodule(self).configure(*options)
+ configure(*options)
@when("@:01")
def configure_args(self):
diff --git a/var/spack/repos/builtin/packages/fjcontrib/package.py b/var/spack/repos/builtin/packages/fjcontrib/package.py
index a7acaa64c0..2563359dd9 100644
--- a/var/spack/repos/builtin/packages/fjcontrib/package.py
+++ b/var/spack/repos/builtin/packages/fjcontrib/package.py
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-import inspect
-
from spack.package import *
@@ -87,9 +85,9 @@ class Fjcontrib(AutotoolsPackage):
def build(self, spec, prefix):
with working_dir(self.build_directory):
for target in self.build_targets:
- inspect.getmodule(self).make(target)
+ make(target)
def install(self, spec, prefix):
with working_dir(self.build_directory):
for target in self.install_targets:
- inspect.getmodule(self).make(target)
+ make(target)
diff --git a/var/spack/repos/builtin/packages/grackle/package.py b/var/spack/repos/builtin/packages/grackle/package.py
index e87b2ef93e..a859ab4ad1 100644
--- a/var/spack/repos/builtin/packages/grackle/package.py
+++ b/var/spack/repos/builtin/packages/grackle/package.py
@@ -3,7 +3,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-import inspect
import os.path
from spack.package import *
@@ -51,9 +50,7 @@ class Grackle(Package):
"@LINK_VARIABLES_DEFINITION": link_variables,
}
- template = join_path(
- os.path.dirname(inspect.getmodule(self).__file__), "Make.mach.template"
- )
+ template = join_path(os.path.dirname(__file__), "Make.mach.template")
makefile = join_path(
self.stage.source_path, "src", "clib", "Make.mach.{0}".format(grackle_architecture)
)
diff --git a/var/spack/repos/builtin/packages/intel-tbb/package.py b/var/spack/repos/builtin/packages/intel-tbb/package.py
index 7e1bff25ab..d3c6e9fef9 100644
--- a/var/spack/repos/builtin/packages/intel-tbb/package.py
+++ b/var/spack/repos/builtin/packages/intel-tbb/package.py
@@ -4,7 +4,6 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import glob
-import inspect
import platform
import sys
@@ -316,14 +315,13 @@ class MakefileBuilder(spack.build_systems.makefile.MakefileBuilder, SetupEnviron
if spec.satisfies("@2017.8,2018.1:"):
# Generate and install the CMake Config file.
- cmake_args = (
- "-DTBB_ROOT={0}".format(prefix),
- "-DTBB_OS={0}".format(platform.system()),
- "-P",
- "tbb_config_generator.cmake",
- )
with working_dir(join_path(self.stage.source_path, "cmake")):
- inspect.getmodule(self).cmake(*cmake_args)
+ cmake(
+ f"-DTBB_ROOT={prefix}",
+ f"-DTBB_OS={platform.system()}",
+ "-P",
+ "tbb_config_generator.cmake",
+ )
@run_after("install")
def darwin_fix(self):
diff --git a/var/spack/repos/builtin/packages/lorene/package.py b/var/spack/repos/builtin/packages/lorene/package.py
index 76ad46d1e1..685495d902 100644
--- a/var/spack/repos/builtin/packages/lorene/package.py
+++ b/var/spack/repos/builtin/packages/lorene/package.py
@@ -3,7 +3,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-import inspect
import os
from spack.package import *
@@ -80,9 +79,7 @@ class Lorene(MakefilePackage):
("@LIB_LAPACK@", lapack_libs + " " + blas_libs),
("@LIB_PGPLOT@", pgplot_libdirs + " " + pgplot_libs),
]
- local_settings_template = join_path(
- os.path.dirname(inspect.getmodule(self).__file__), "local_settings.template"
- )
+ local_settings_template = join_path(os.path.dirname(__file__), "local_settings.template")
local_settings = join_path(self.stage.source_path, "local_settings")
copy(local_settings_template, local_settings)
for key, value in substitutions:
diff --git a/var/spack/repos/builtin/packages/ollama/package.py b/var/spack/repos/builtin/packages/ollama/package.py
index 8213efdebc..98a171998f 100644
--- a/var/spack/repos/builtin/packages/ollama/package.py
+++ b/var/spack/repos/builtin/packages/ollama/package.py
@@ -49,9 +49,5 @@ class GoBuilder(spack.build_systems.go.GoBuilder):
def generate(self, pkg, spec, prefix):
"""Runs ``go generate`` in the source directory"""
- import inspect
-
- import llnl.util.filesystem as fs
-
- with fs.working_dir(self.build_directory):
- inspect.getmodule(pkg).go("generate", *self.generate_args)
+ with working_dir(self.build_directory):
+ go("generate", *self.generate_args)
diff --git a/var/spack/repos/builtin/packages/perl-bioperl/package.py b/var/spack/repos/builtin/packages/perl-bioperl/package.py
index ddbcc265b6..790446ad91 100644
--- a/var/spack/repos/builtin/packages/perl-bioperl/package.py
+++ b/var/spack/repos/builtin/packages/perl-bioperl/package.py
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-import inspect
-
from spack.package import *
@@ -105,7 +103,7 @@ class PerlBioperl(PerlPackage):
f.writelines(config_answers)
with open(config_answers_filename, "r") as f:
- inspect.getmodule(self).perl("Build.PL", "--install_base=%s" % self.prefix, input=f)
+ perl("Build.PL", "--install_base=%s" % self.prefix, input=f)
# Need to also override the build and install methods to make sure that the
# Build script is run through perl and not use the shebang, as it might be
@@ -113,8 +111,8 @@ class PerlBioperl(PerlPackage):
# `@run_after(configure)` step defined in `PerlPackage`.
@when("@1.007002")
def build(self, spec, prefix):
- inspect.getmodule(self).perl("Build")
+ perl("Build")
@when("@1.007002")
def install(self, spec, prefix):
- inspect.getmodule(self).perl("Build", "install")
+ perl("Build", "install")
diff --git a/var/spack/repos/builtin/packages/perl-io-socket-ssl/package.py b/var/spack/repos/builtin/packages/perl-io-socket-ssl/package.py
index 143360fd20..08e6aa2117 100644
--- a/var/spack/repos/builtin/packages/perl-io-socket-ssl/package.py
+++ b/var/spack/repos/builtin/packages/perl-io-socket-ssl/package.py
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-import inspect
-
from spack.package import *
@@ -23,7 +21,7 @@ class PerlIoSocketSsl(PerlPackage):
def configure(self, spec, prefix):
self.build_method = "Makefile.PL"
- self.build_executable = inspect.getmodule(self).make
+ self.build_executable = make
# Should I do external tests?
config_answers = ["n\n"]
config_answers_filename = "spack-config.in"
@@ -32,4 +30,4 @@ class PerlIoSocketSsl(PerlPackage):
f.writelines(config_answers)
with open(config_answers_filename, "r") as f:
- inspect.getmodule(self).perl("Makefile.PL", f"INSTALL_BASE={prefix}", input=f)
+ perl("Makefile.PL", f"INSTALL_BASE={prefix}", input=f)
diff --git a/var/spack/repos/builtin/packages/perl-net-ssleay/package.py b/var/spack/repos/builtin/packages/perl-net-ssleay/package.py
index f03f030f00..03d27156da 100644
--- a/var/spack/repos/builtin/packages/perl-net-ssleay/package.py
+++ b/var/spack/repos/builtin/packages/perl-net-ssleay/package.py
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-import inspect
-
from spack.package import *
@@ -25,7 +23,7 @@ class PerlNetSsleay(PerlPackage):
def configure(self, spec, prefix):
self.build_method = "Makefile.PL"
- self.build_executable = inspect.getmodule(self).make
+ self.build_executable = make
# Do you want to run external tests?
config_answers = ["\n"]
config_answers_filename = "spack-config.in"
@@ -35,4 +33,4 @@ class PerlNetSsleay(PerlPackage):
with open(config_answers_filename, "r") as f:
env["OPENSSL_PREFIX"] = self.spec["openssl"].prefix
- inspect.getmodule(self).perl("Makefile.PL", "INSTALL_BASE={0}".format(prefix), input=f)
+ perl("Makefile.PL", "INSTALL_BASE={0}".format(prefix), input=f)
diff --git a/var/spack/repos/builtin/packages/pexsi/package.py b/var/spack/repos/builtin/packages/pexsi/package.py
index b8ef54bc26..04d1350d5e 100644
--- a/var/spack/repos/builtin/packages/pexsi/package.py
+++ b/var/spack/repos/builtin/packages/pexsi/package.py
@@ -3,9 +3,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-import inspect
-import os.path
-
import spack.build_systems.cmake
import spack.build_systems.makefile
from spack.package import *
@@ -94,7 +91,7 @@ class MakefileBuilder(spack.build_systems.makefile.MakefileBuilder):
substitutions.append(("@FLDFLAGS", fldflags.lstrip()))
- template = join_path(os.path.dirname(inspect.getmodule(self).__file__), "make.inc")
+ template = join_path(os.path.dirname(__file__), "make.inc")
makefile = join_path(pkg.stage.source_path, "make.inc")
copy(template, makefile)
for key, value in substitutions:
diff --git a/var/spack/repos/builtin/packages/wannier90/package.py b/var/spack/repos/builtin/packages/wannier90/package.py
index 54f0f7f6d1..417cdc38f7 100644
--- a/var/spack/repos/builtin/packages/wannier90/package.py
+++ b/var/spack/repos/builtin/packages/wannier90/package.py
@@ -3,7 +3,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-import inspect
import os.path
from spack.package import *
@@ -80,7 +79,7 @@ class Wannier90(MakefilePackage):
"@LIBS": (lapack + blas + mpi).joined(),
}
- template = join_path(os.path.dirname(inspect.getmodule(self).__file__), "make.sys")
+ template = join_path(os.path.dirname(__file__), "make.sys")
copy(template, self.makefile_name)
for key, value in substitutions.items():