Attributes for directives need to be set at class construction time. (#1718)
- moved ensure_dicts() call from Package.__init__ to Package.__metaclass__.
This commit is contained in:
parent
ea6143402f
commit
07fa1cd5f8
@ -329,6 +329,12 @@ class SomePackage(Package):
|
||||
"""
|
||||
sanity_check_is_dir = []
|
||||
|
||||
class __metaclass__(type):
|
||||
"""Ensure attributes required by Spack directives are present."""
|
||||
def __init__(cls, name, bases, dict):
|
||||
type.__init__(cls, name, bases, dict)
|
||||
spack.directives.ensure_dicts(cls)
|
||||
|
||||
def __init__(self, spec):
|
||||
# this determines how the package should be built.
|
||||
self.spec = spec
|
||||
@ -342,9 +348,6 @@ def __init__(self, spec):
|
||||
# Allow custom staging paths for packages
|
||||
self.path = None
|
||||
|
||||
# Sanity check attributes required by Spack directives.
|
||||
spack.directives.ensure_dicts(type(self))
|
||||
|
||||
# Check versions in the versions dict.
|
||||
for v in self.versions:
|
||||
assert (isinstance(v, Version))
|
||||
|
Loading…
Reference in New Issue
Block a user