Skip to content
Snippets Groups Projects
Commit 07fa1cd5 authored by Todd Gamblin's avatar Todd Gamblin Committed by GitHub
Browse files

Attributes for directives need to be set at class construction time. (#1718)

- moved ensure_dicts() call from Package.__init__ to
  Package.__metaclass__.
parent ea614340
No related branches found
No related tags found
No related merge requests found
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment