Add an alias for SpecfileLatest
This commit is contained in:
parent
99489c236f
commit
15f0871a6f
@ -240,8 +240,8 @@ def from_json(stream, repository):
|
||||
index.providers = _transform(
|
||||
providers,
|
||||
lambda vpkg, plist: (
|
||||
spack.spec.SpecfileV5.from_node_dict(vpkg),
|
||||
set(spack.spec.SpecfileV5.from_node_dict(p) for p in plist),
|
||||
spack.spec.SpecfileLatest.from_node_dict(vpkg),
|
||||
set(spack.spec.SpecfileLatest.from_node_dict(p) for p in plist),
|
||||
),
|
||||
)
|
||||
return index
|
||||
|
@ -5103,6 +5103,10 @@ def legacy_compiler(cls, node):
|
||||
raise RuntimeError("The 'compiler' option is unexpected in specfiles at v5 or greater")
|
||||
|
||||
|
||||
#: Alias to the latest version of specfiles
|
||||
SpecfileLatest = SpecfileV5
|
||||
|
||||
|
||||
class LazySpecCache(collections.defaultdict):
|
||||
"""Cache for Specs that uses a spec_like as key, and computes lazily
|
||||
the corresponding value ``Spec(spec_like``.
|
||||
|
@ -504,3 +504,10 @@ def test_pickle_roundtrip_for_abstract_specs(spec_str):
|
||||
t = pickle.loads(pickle.dumps(s))
|
||||
assert s == t
|
||||
assert str(s) == str(t)
|
||||
|
||||
|
||||
def test_specfile_alias_is_updated():
|
||||
"""Tests that the SpecfileLatest alias gets updated on a Specfile version bump"""
|
||||
specfile_class_name = f"SpecfileV{spack.spec.SPECFILE_FORMAT_VERSION}"
|
||||
specfile_cls = getattr(spack.spec, specfile_class_name)
|
||||
assert specfile_cls is spack.spec.SpecfileLatest
|
||||
|
Loading…
Reference in New Issue
Block a user