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(
|
index.providers = _transform(
|
||||||
providers,
|
providers,
|
||||||
lambda vpkg, plist: (
|
lambda vpkg, plist: (
|
||||||
spack.spec.SpecfileV5.from_node_dict(vpkg),
|
spack.spec.SpecfileLatest.from_node_dict(vpkg),
|
||||||
set(spack.spec.SpecfileV5.from_node_dict(p) for p in plist),
|
set(spack.spec.SpecfileLatest.from_node_dict(p) for p in plist),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
return index
|
return index
|
||||||
|
@ -5103,6 +5103,10 @@ def legacy_compiler(cls, node):
|
|||||||
raise RuntimeError("The 'compiler' option is unexpected in specfiles at v5 or greater")
|
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):
|
class LazySpecCache(collections.defaultdict):
|
||||||
"""Cache for Specs that uses a spec_like as key, and computes lazily
|
"""Cache for Specs that uses a spec_like as key, and computes lazily
|
||||||
the corresponding value ``Spec(spec_like``.
|
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))
|
t = pickle.loads(pickle.dumps(s))
|
||||||
assert s == t
|
assert s == t
|
||||||
assert str(s) == str(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