summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-07-20 13:15:57 -0700
committerGitHub <noreply@github.com>2016-07-20 13:15:57 -0700
commit8856a226c79be5822786a7b5da5a8f8251e8f1cb (patch)
tree6e85b187d924928fbb92475986468213c5db7b73
parentd8acd41ba162b86d95561528a117ed8b5b442005 (diff)
parent1315753e704615a37cde4e3a6b342cd253bfd95b (diff)
downloadspack-8856a226c79be5822786a7b5da5a8f8251e8f1cb.tar.gz
spack-8856a226c79be5822786a7b5da5a8f8251e8f1cb.tar.bz2
spack-8856a226c79be5822786a7b5da5a8f8251e8f1cb.tar.xz
spack-8856a226c79be5822786a7b5da5a8f8251e8f1cb.zip
Merge pull request #1277 from mathstuf/special-deptypes
deptypes: support special deptypes by string
-rw-r--r--lib/spack/docs/packaging_guide.rst6
-rw-r--r--lib/spack/spack/directives.py2
-rw-r--r--lib/spack/spack/spec.py7
3 files changed, 10 insertions, 5 deletions
diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst
index 6bafaecc7d..70def5c39a 100644
--- a/lib/spack/docs/packaging_guide.rst
+++ b/lib/spack/docs/packaging_guide.rst
@@ -1307,9 +1307,9 @@ The dependency types are:
If not specified, ``type`` is assumed to be ``("build", "link")``. This is the
common case for compiled language usage. Also available are the aliases
-``alldeps`` for all dependency types and ``nolink`` (``("build", "run")``) for
-use by dependencies which are not expressed via a linker (e.g., Python or Lua
-module loading).
+``"alldeps"`` for all dependency types and ``"nolink"`` (``("build", "run")``)
+for use by dependencies which are not expressed via a linker (e.g., Python or
+Lua module loading).
.. _setup-dependent-environment:
diff --git a/lib/spack/spack/directives.py b/lib/spack/spack/directives.py
index 88d2aaf472..e92dd6fb67 100644
--- a/lib/spack/spack/directives.py
+++ b/lib/spack/spack/directives.py
@@ -189,7 +189,7 @@ def _depends_on(pkg, spec, when=None, type=None):
type = ('build', 'link')
if isinstance(type, str):
- type = (type,)
+ type = spack.spec.special_types.get(type, (type,))
for deptype in type:
if deptype not in spack.spec.alldeps:
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index e694f2b2da..8bdae0445e 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -155,6 +155,10 @@ _any_version = VersionList([':'])
# Special types of dependencies.
alldeps = ('build', 'link', 'run')
nolink = ('build', 'run')
+special_types = {
+ 'alldeps': alldeps,
+ 'nolink': nolink,
+}
def index_specs(specs):
@@ -542,7 +546,8 @@ class Spec(object):
return alldeps
# Force deptype to be a set object so that we can do set intersections.
if isinstance(deptype, str):
- return (deptype,)
+ # Support special deptypes.
+ return special_types.get(deptype, (deptype,))
return deptype
def _find_deps(self, where, deptype):