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
|
If not specified, ``type`` is assumed to be ``("build", "link")``. This is the
|
||||||
common case for compiled language usage. Also available are the aliases
|
common case for compiled language usage. Also available are the aliases
|
||||||
``alldeps`` for all dependency types and ``nolink`` (``("build", "run")``) for
|
``"alldeps"`` for all dependency types and ``"nolink"`` (``("build", "run")``)
|
||||||
use by dependencies which are not expressed via a linker (e.g., Python or Lua
|
for use by dependencies which are not expressed via a linker (e.g., Python or
|
||||||
module loading).
|
Lua module loading).
|
||||||
|
|
||||||
.. _setup-dependent-environment:
|
.. _setup-dependent-environment:
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ def _depends_on(pkg, spec, when=None, type=None):
|
||||||
type = ('build', 'link')
|
type = ('build', 'link')
|
||||||
|
|
||||||
if isinstance(type, str):
|
if isinstance(type, str):
|
||||||
type = (type,)
|
type = spack.spec.special_types.get(type, (type,))
|
||||||
|
|
||||||
for deptype in type:
|
for deptype in type:
|
||||||
if deptype not in spack.spec.alldeps:
|
if deptype not in spack.spec.alldeps:
|
||||||
|
|
|
@ -155,6 +155,10 @@
|
||||||
# Special types of dependencies.
|
# Special types of dependencies.
|
||||||
alldeps = ('build', 'link', 'run')
|
alldeps = ('build', 'link', 'run')
|
||||||
nolink = ('build', 'run')
|
nolink = ('build', 'run')
|
||||||
|
special_types = {
|
||||||
|
'alldeps': alldeps,
|
||||||
|
'nolink': nolink,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def index_specs(specs):
|
def index_specs(specs):
|
||||||
|
@ -542,7 +546,8 @@ def _deptype_norm(self, deptype):
|
||||||
return alldeps
|
return alldeps
|
||||||
# Force deptype to be a set object so that we can do set intersections.
|
# Force deptype to be a set object so that we can do set intersections.
|
||||||
if isinstance(deptype, str):
|
if isinstance(deptype, str):
|
||||||
return (deptype,)
|
# Support special deptypes.
|
||||||
|
return special_types.get(deptype, (deptype,))
|
||||||
return deptype
|
return deptype
|
||||||
|
|
||||||
def _find_deps(self, where, deptype):
|
def _find_deps(self, where, deptype):
|
||||||
|
|
Loading…
Reference in a new issue