summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2016-07-18 14:23:29 -0400
committerBen Boeckel <ben.boeckel@kitware.com>2016-07-19 16:26:18 -0400
commit1315753e704615a37cde4e3a6b342cd253bfd95b (patch)
tree42ecabf2e2a8ec02775b01041657e49a65283658 /lib
parent0a89342508c981fbf5cdf220a5821a1733ac29ab (diff)
downloadspack-1315753e704615a37cde4e3a6b342cd253bfd95b.tar.gz
spack-1315753e704615a37cde4e3a6b342cd253bfd95b.tar.bz2
spack-1315753e704615a37cde4e3a6b342cd253bfd95b.tar.xz
spack-1315753e704615a37cde4e3a6b342cd253bfd95b.zip
deptypes: support special deptypes by string
Diffstat (limited to 'lib')
-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):