Merge pull request #1277 from mathstuf/special-deptypes
deptypes: support special deptypes by string
This commit is contained in:
commit
8856a226c7
3 changed files with 10 additions and 5 deletions
|
@ -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:
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -155,6 +155,10 @@
|
|||
# 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 @@ def _deptype_norm(self, deptype):
|
|||
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):
|
||||
|
|
Loading…
Reference in a new issue