summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2021-12-10 06:30:21 -0600
committerGitHub <noreply@github.com>2021-12-10 13:30:21 +0100
commit0960c0810c387a8fff1788ecda13ab4a11eac332 (patch)
treef9386445d00e3f67583c84ab6f91cbcf66c2d481 /lib
parentdc87157e80a25c4d3fa1b75bf42f80b3560b362d (diff)
downloadspack-0960c0810c387a8fff1788ecda13ab4a11eac332.tar.gz
spack-0960c0810c387a8fff1788ecda13ab4a11eac332.tar.bz2
spack-0960c0810c387a8fff1788ecda13ab4a11eac332.tar.xz
spack-0960c0810c387a8fff1788ecda13ab4a11eac332.zip
Extends: support spec, not just package name (#27754)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/directives.py3
-rw-r--r--lib/spack/spack/test/directives.py9
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/spack/spack/directives.py b/lib/spack/spack/directives.py
index f7400f4da9..c23146125a 100644
--- a/lib/spack/spack/directives.py
+++ b/lib/spack/spack/directives.py
@@ -466,7 +466,8 @@ def extends(spec, type=('build', 'run'), **kwargs):
return
_depends_on(pkg, spec, when=when, type=type)
- pkg.extendees[spec] = (spack.spec.Spec(spec), kwargs)
+ spec_obj = spack.spec.Spec(spec)
+ pkg.extendees[spec_obj.name] = (spec_obj, kwargs)
return _execute_extends
diff --git a/lib/spack/spack/test/directives.py b/lib/spack/spack/test/directives.py
index 31038ebb47..ad7c98bdb9 100644
--- a/lib/spack/spack/test/directives.py
+++ b/lib/spack/spack/test/directives.py
@@ -51,3 +51,12 @@ def test_constraints_from_context_are_merged(mock_packages):
assert pkg_cls.dependencies
assert spack.spec.Spec('@0.14:15 ^b@3.8:4.0') in pkg_cls.dependencies['c']
+
+
+@pytest.mark.regression('27754')
+def test_extends_spec(config, mock_packages):
+ extender = spack.spec.Spec('extends-spec').concretized()
+ extendee = spack.spec.Spec('extendee').concretized()
+
+ assert extender.dependencies
+ assert extender.package.extends(extendee)