Extends: support spec, not just package name (#27754)
This commit is contained in:
parent
dc87157e80
commit
0960c0810c
@ -466,7 +466,8 @@ def _execute_extends(pkg):
|
|||||||
return
|
return
|
||||||
|
|
||||||
_depends_on(pkg, spec, when=when, type=type)
|
_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
|
return _execute_extends
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,3 +51,12 @@ def test_constraints_from_context_are_merged(mock_packages):
|
|||||||
|
|
||||||
assert pkg_cls.dependencies
|
assert pkg_cls.dependencies
|
||||||
assert spack.spec.Spec('@0.14:15 ^b@3.8:4.0') in pkg_cls.dependencies['c']
|
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)
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
|
||||||
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
|
from spack import *
|
||||||
|
|
||||||
|
|
||||||
|
class ExtendsSpec(Package):
|
||||||
|
"""Package that tests if the extends directive supports a spec."""
|
||||||
|
|
||||||
|
homepage = "http://www.example.com"
|
||||||
|
url = "http://www.example.com/example-1.0.tar.gz"
|
||||||
|
|
||||||
|
version('1.0', '0123456789abcdef0123456789abcdef')
|
||||||
|
|
||||||
|
extends('extendee@1:')
|
Loading…
Reference in New Issue
Block a user