diff --git a/var/spack/repos/builtin/packages/evtgen/package.py b/var/spack/repos/builtin/packages/evtgen/package.py index 093f029ab88..41a44bad543 100644 --- a/var/spack/repos/builtin/packages/evtgen/package.py +++ b/var/spack/repos/builtin/packages/evtgen/package.py @@ -97,7 +97,7 @@ def configure(self, spec, prefix): 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 a7acaa64c0f..2563359dd9b 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 @@ def configure_args(self): 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 e87b2ef93e1..a859ab4ad14 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 @@ def install(self, spec, prefix): "@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 7e1bff25abb..d3c6e9fef91 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 @@ def install(self, pkg, spec, prefix): 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 76ad46d1e14..685495d9024 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 @@ def edit(self, spec, prefix): ("@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 8213efdebc1..98a171998fc 100644 --- a/var/spack/repos/builtin/packages/ollama/package.py +++ b/var/spack/repos/builtin/packages/ollama/package.py @@ -49,9 +49,5 @@ def generate_args(self): 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 ddbcc265b69..790446ad915 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 @@ def configure(self, spec, prefix): 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 @@ def configure(self, spec, prefix): # `@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 143360fd204..08e6aa21175 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 @@ def configure(self, spec, prefix): 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 f03f030f002..03d27156da1 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 @@ def configure(self, spec, prefix): 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 b8ef54bc26f..395ab1299b1 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 @@ def edit(self, pkg, spec, prefix): substitutions.append(("@FLDFLAGS", fldflags.lstrip())) - template = join_path(os.path.dirname(inspect.getmodule(self).__file__), "make.inc") + template = join_path(__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 54f0f7f6d12..417cdc38f7c 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 @@ def edit(self, spec, prefix): "@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():