Directive inheritance: laziness for the win (#2623)

* inheritance of directives: using meta-classes to inject attributes coming from directives into packages + lazy directives

* _dep_types -> dependency_types
* using a meta-class to inject directives into packages
* directives are lazy

fixes #2466

* directives.py: allows for multiple inheritance. Added blank lines as suggested by @tgamblin

* directives.py: added a test for simple inheritance of directives

* Minor improvement requested by @tgamblin

CMakePackage: importing names from spack.directives
directives: wrap __new__ to respect pep8

* Refactoring requested by @tgamblin

directives: removed global variables in favor of class variables. Simplified the interface for directives (they return a callable on a package or a list of them).
This commit is contained in:
Massimiliano Culpo
2016-12-28 21:37:02 +01:00
committed by Todd Gamblin
parent 857dac88c8
commit 17b13b161b
11 changed files with 282 additions and 203 deletions

View File

@@ -0,0 +1,24 @@
from spack import *
class BaseWithDirectives(Package):
depends_on('cmake', type='build')
depends_on('mpi')
variant('openblas', description='Activates openblas', default=True)
provides('service1')
class SimpleInheritance(BaseWithDirectives):
"""Simple package which acts as a build dependency"""
homepage = "http://www.example.com"
url = "http://www.example.com/simple-1.0.tar.gz"
version('1.0', '0123456789abcdef0123456789abcdef')
depends_on('openblas', when='+openblas')
provides('lapack', when='+openblas')
def install(self, spec, prefix):
pass

View File

@@ -90,7 +90,6 @@ class Dealii(CMakePackage):
"boost@1.59.0:+thread+system+serialization+iostreams+mpi+python",
when='@8.5.0:+mpi+python')
depends_on("bzip2")
depends_on("cmake", type='build')
depends_on("lapack")
depends_on("muparser")
depends_on("suite-sparse")

View File

@@ -43,5 +43,3 @@ class Openjpeg(CMakePackage):
version('2.0', 'cdf266530fee8af87454f15feb619609')
version('1.5.2', '545f98923430369a6b046ef3632ef95c')
version('1.5.1', 'd774e4b5a0db5f0f171c4fc0aabfa14e')
depends_on('cmake', type='build')

View File

@@ -36,8 +36,6 @@ class YamlCpp(CMakePackage):
variant('fpic', default=False,
description='Build with position independent code')
depends_on('cmake', type='build')
depends_on('boost', when='@:0.5.3')
def cmake_args(self):