summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2013-12-08 21:38:37 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2013-12-08 21:38:37 -0800
commitfa2e8dab11e9516fc950f982dfe812f8d3f68b03 (patch)
treecbec6f8c34c45616f5fba44e21260830828a0360 /lib
parente0c029c347cc15109f8cace38a2883f35e75b500 (diff)
downloadspack-fa2e8dab11e9516fc950f982dfe812f8d3f68b03.tar.gz
spack-fa2e8dab11e9516fc950f982dfe812f8d3f68b03.tar.bz2
spack-fa2e8dab11e9516fc950f982dfe812f8d3f68b03.tar.xz
spack-fa2e8dab11e9516fc950f982dfe812f8d3f68b03.zip
Additional circular reference checking
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/relations.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/spack/spack/relations.py b/lib/spack/spack/relations.py
index ab884db528..f282351b86 100644
--- a/lib/spack/spack/relations.py
+++ b/lib/spack/spack/relations.py
@@ -127,7 +127,7 @@ def depends_on(*specs):
for string in specs:
for spec in spack.spec.parse(string):
if pkg == spec.name:
- raise CircularDependencyError('depends_on', pkg)
+ raise CircularReferenceError('depends_on', pkg)
dependencies[spec.name] = spec
@@ -143,6 +143,8 @@ def provides(*specs, **kwargs):
provided = _caller_locals().setdefault("provided", {})
for string in specs:
for provided_spec in spack.spec.parse(string):
+ if pkg == provided_spec.name:
+ raise CircularReferenceError('depends_on', pkg)
provided[provided_spec] = provider_spec
@@ -171,8 +173,10 @@ class ScopeError(RelationError):
"Cannot inovke '%s' from outside of a Spack package!" % relation)
-class CircularDependencyError(RelationError):
+class CircularReferenceError(RelationError):
"""This is raised when something depends on itself."""
def __init__(self, relation, package):
- super(CircularDependencyError, self).__init__(
- relation, "Package %s cannot depend on itself." % package)
+ super(CircularReferenceError, self).__init__(
+ relation,
+ "Package '%s' cannot pass itself to %s." % (package, relation))
+ self.package = package