summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/package.py5
-rw-r--r--lib/spack/spack/relations.py41
-rw-r--r--lib/spack/spack/spec.py7
3 files changed, 34 insertions, 19 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index e15a1f97eb..59ce6afd7e 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -255,6 +255,11 @@ class Package(object):
"""List of specs of virtual packages provided by this package."""
provided = {}
+ """List of specs of conflicting packages.
+ TODO: implement conflicts.
+ """
+ conflicted = {}
+
#
# These are default values for instance variables.
#
diff --git a/lib/spack/spack/relations.py b/lib/spack/spack/relations.py
index 0d1983257b..323c9db2ac 100644
--- a/lib/spack/spack/relations.py
+++ b/lib/spack/spack/relations.py
@@ -62,23 +62,28 @@ def _caller_locals():
del stack
-def depends_on(*specs):
- """Adds a dependencies local variable in the locals of
- the calling class, based on args.
- """
- # Get the enclosing package's scope and add deps to it.
- dependencies = _caller_locals().setdefault("dependencies", {})
- for string in specs:
- for spec in spack.spec.parse(string):
- dependencies[spec.name] = spec
+def _make_relation(map_name):
+ def relation_fun(*specs):
+ package_map = _caller_locals().setdefault(map_name, {})
+ for string in specs:
+ for spec in spack.spec.parse(string):
+ package_map[spec.name] = spec
+ return relation_fun
-def provides(*args):
- """Allows packages to provide a virtual dependency. If a package provides
- "mpi", other packages can declare that they depend on "mpi", and spack
- can use the providing package to satisfy the dependency.
- """
- # Get the enclosing package's scope and add deps to it.
- provided = _caller_locals().setdefault("provided", [])
- for name in args:
- provided.append(name)
+"""Adds a dependencies local variable in the locals of
+ the calling class, based on args. """
+depends_on = _make_relation("dependencies")
+
+
+"""Allows packages to provide a virtual dependency. If a package provides
+ 'mpi', other packages can declare that they depend on "mpi", and spack
+ can use the providing package to satisfy the dependency.
+"""
+provides = _make_relation("provided")
+
+
+"""Packages can declare conflicts with other packages.
+ This can be as specific as you like: use regular spec syntax.
+"""
+conflicts = _make_relation("conflicted")
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index d14957c23b..e6d508c074 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -394,7 +394,12 @@ class Spec(object):
def _concretize_helper(self, presets):
- """Recursive helper function for concretize()."""
+ """Recursive helper function for concretize().
+ This concretizes everything bottom-up. As things are
+ concretized, they're added to the presets, and ancestors
+ will prefer the settings of their children.
+ """
+ # Concretize deps first -- this is a bottom-up process.
for name in sorted(self.dependencies.keys()):
self.dependencies[name]._concretize_helper(presets)