builtin: remove redundant use of inspec

This commit is contained in:
Harmen Stoppels 2024-08-28 12:16:45 +02:00
parent fb4811ec3f
commit 45ec04ef7c
11 changed files with 22 additions and 46 deletions

View File

@ -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):

View File

@ -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)

View File

@ -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)
)

View File

@ -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):

View File

@ -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:

View File

@ -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)

View File

@ -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")

View File

@ -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)

View File

@ -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)

View File

@ -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:

View File

@ -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():