GenericBuilder: facilitate post-install phase test callbacks (#35314)
This commit is contained in:
parent
3714d3443b
commit
383a343412
@ -8,7 +8,7 @@
|
||||
import spack.directives
|
||||
import spack.package_base
|
||||
|
||||
from ._checks import BaseBuilder, apply_macos_rpath_fixups
|
||||
from ._checks import BaseBuilder, apply_macos_rpath_fixups, execute_install_time_tests
|
||||
|
||||
|
||||
class Package(spack.package_base.PackageBase):
|
||||
@ -38,7 +38,16 @@ class GenericBuilder(BaseBuilder):
|
||||
legacy_methods: Tuple[str, ...] = ()
|
||||
|
||||
#: Names associated with package attributes in the old build-system format
|
||||
legacy_attributes: Tuple[str, ...] = ("archive_files",)
|
||||
legacy_attributes: Tuple[str, ...] = (
|
||||
"archive_files",
|
||||
"install_time_test_callbacks",
|
||||
)
|
||||
|
||||
#: Callback names for post-install phase tests
|
||||
install_time_test_callbacks = []
|
||||
|
||||
# On macOS, force rpaths for shared library IDs and remove duplicate rpaths
|
||||
spack.builder.run_after("install", when="platform=darwin")(apply_macos_rpath_fixups)
|
||||
|
||||
# unconditionally perform any post-install phase tests
|
||||
spack.builder.run_after("install")(execute_install_time_tests)
|
||||
|
@ -39,6 +39,13 @@ class Oommf(Package):
|
||||
# default URL for versions
|
||||
url = "https://github.com/fangohr/oommf/archive/refs/tags/20a1_20180930_ext.tar.gz"
|
||||
|
||||
#: post-install phase methods used to check the installation
|
||||
install_time_test_callbacks = [
|
||||
"check_install_version",
|
||||
"check_install_platform",
|
||||
"check_install_stdprob3",
|
||||
]
|
||||
|
||||
maintainers("fangohr")
|
||||
|
||||
version(
|
||||
@ -220,15 +227,12 @@ def _check_install_oommf_command(self, oommf_args):
|
||||
|
||||
print("output received from oommf is %s" % output)
|
||||
|
||||
@run_after("install")
|
||||
def check_install_version(self):
|
||||
self._check_install_oommf_command(["+version"])
|
||||
|
||||
@run_after("install")
|
||||
def check_install_platform(self):
|
||||
self._check_install_oommf_command(["+platform"])
|
||||
|
||||
@run_after("install")
|
||||
def check_install_stdprob3(self):
|
||||
oommf_examples = join_path(self.spec.prefix.usr.bin, "oommf/app/oxs/examples")
|
||||
task = join_path(oommf_examples, "stdprob3.mif")
|
||||
|
Loading…
Reference in New Issue
Block a user