Skip to content
Snippets Groups Projects
Commit 482f60d1 authored by Massimiliano Culpo's avatar Massimiliano Culpo
Browse files

packages : moved decorators into AutotoolsPackage and CMakePackage

parent 012da996
No related branches found
No related tags found
No related merge requests found
...@@ -1733,6 +1733,16 @@ def build(self, spec, prefix): ...@@ -1733,6 +1733,16 @@ def build(self, spec, prefix):
def install(self, spec, prefix): def install(self, spec, prefix):
inspect.getmodule(self).make('install') inspect.getmodule(self).make('install')
@PackageBase.sanity_check('build')
@PackageBase.on_package_attributes(run_tests=True)
def _run_default_function(self):
try:
fn = getattr(self, 'check')
tty.msg('Trying default sanity checks [check]')
fn()
except AttributeError:
tty.msg('Skipping default sanity checks [method `check` not implemented]') # NOQA: ignore=E501
# This will be used as a registration decorator in user # This will be used as a registration decorator in user
# packages, if need be # packages, if need be
PackageBase.sanity_check('install')(PackageBase.sanity_check_prefix) PackageBase.sanity_check('install')(PackageBase.sanity_check_prefix)
...@@ -1792,6 +1802,16 @@ def install(self, spec, prefix): ...@@ -1792,6 +1802,16 @@ def install(self, spec, prefix):
with working_dir(self.wdir()): with working_dir(self.wdir()):
inspect.getmodule(self).make('install') inspect.getmodule(self).make('install')
@PackageBase.sanity_check('build')
@PackageBase.on_package_attributes(run_tests=True)
def _run_default_function(self):
try:
fn = getattr(self, 'check')
tty.msg('Trying default sanity checks [check]')
fn()
except AttributeError:
tty.msg('Skipping default sanity checks [method `check` not implemented]') # NOQA: ignore=E501
PackageBase.sanity_check('install')(PackageBase.sanity_check_prefix) PackageBase.sanity_check('install')(PackageBase.sanity_check_prefix)
......
...@@ -25,10 +25,8 @@ ...@@ -25,10 +25,8 @@
from spack import * from spack import *
class Autoconf(Package): class Autoconf(AutotoolsPackage):
""" """Autoconf -- system configuration part of autotools"""
Autoconf -- system configuration part of autotools
"""
homepage = 'https://www.gnu.org/software/autoconf/' homepage = 'https://www.gnu.org/software/autoconf/'
url = 'http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz' url = 'http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz'
...@@ -54,8 +52,3 @@ def setup_dependent_package(self, module, dependent_spec): ...@@ -54,8 +52,3 @@ def setup_dependent_package(self, module, dependent_spec):
'ifnames'] 'ifnames']
for name in executables: for name in executables:
setattr(module, name, self._make_executable(name)) setattr(module, name, self._make_executable(name))
def install(self, spec, prefix):
configure("--prefix=%s" % prefix)
make()
make("install")
...@@ -143,9 +143,7 @@ def configure_args(self): ...@@ -143,9 +143,7 @@ def configure_args(self):
return ["--with-zlib=%s" % spec['zlib'].prefix] + extra_args return ["--with-zlib=%s" % spec['zlib'].prefix] + extra_args
@AutotoolsPackage.sanity_check('install') def check(self):
@AutotoolsPackage.on_package_attributes(run_tests=True)
def check_install(self):
"Build and run a small program to test the installed HDF5 library" "Build and run a small program to test the installed HDF5 library"
spec = self.spec spec = self.spec
print("Checking HDF5 installation...") print("Checking HDF5 installation...")
......
...@@ -43,8 +43,6 @@ def configure_args(self): ...@@ -43,8 +43,6 @@ def configure_args(self):
'--enable-shared' '--enable-shared'
] ]
@AutotoolsPackage.sanity_check('build')
@AutotoolsPackage.on_package_attributes(run_tests=True)
def check(self): def check(self):
make('check') make('check')
make('test') make('test')
...@@ -45,7 +45,5 @@ class Qhull(CMakePackage): ...@@ -45,7 +45,5 @@ class Qhull(CMakePackage):
depends_on('cmake@2.6:', type='build') depends_on('cmake@2.6:', type='build')
@CMakePackage.sanity_check('build')
@CMakePackage.on_package_attributes(run_tests=True)
def check(self): def check(self):
make('test') make('test')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment