Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions conan/api/model/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,14 @@ def split(self):
result.append(subpkglist)
return result

def only_recipes(self):
result = {}
def only_recipes(self) -> dict:
""" Filter out all the packages and package revisions, returning only the recipes and
recipe revisions.
"""
for ref, ref_dict in self.recipes.items():
for rrev_dict in ref_dict.get("revisions", {}).values():
rrev_dict.pop("packages", None)
return result
return self.recipes.copy()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is redundant. The current usages of only_recipes in Conan do not use the return value, better to just drop it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped in the commit 7b0f9e3


def add_refs(self, refs):
# RREVS alreday come in ASCENDING order, so upload does older revisions first
Expand Down
49 changes: 49 additions & 0 deletions test/unittests/model/test_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from conan.api.model import PackagesList


def test_package_list_only_recipes():
pl = PackagesList()
pl.recipes = {
"foobar/0.1.0": {'revisions':
{'85eb0587a3c12b90216c72070e9eef3e':
{'timestamp': 1740151190.975,
'packages': {'c29f32beda3c361f536ba35aae5e876faf970169':
{'revisions': {
'9a0569c04839fff6a6e8f40e10434bc6':
{'timestamp': 1742417567.684486}},
'info': {}}}}}},
"qux/0.2.1": {'revisions':
{'71c3c11b98a6f2ae11f0f391f5e62e2b':
{'timestamp': 1740151186.976, 'packages':
{'13be611585c95453f1cbbd053cea04b3e64470ca':
{'revisions': {'5c7e0c0788cd4d89249ad251f0868787':
{'timestamp': 1740152032.884}},
'info':
{'settings':
{'arch': 'x86_64',
'build_type': 'Release',
'compiler': 'gcc',
'compiler.cppstd': '17',
'compiler.libcxx': 'libstdc++11',
'compiler.version': '11', 'os': 'Linux'},
'options': {'fPIC': 'True', 'shared': 'False'}}},
'30652ea35b512fa3fe0f4dcd39ad217e4e60bd01':
{'revisions': {'8f363f1d95ad766ac400e1f1f5406599':
{'timestamp': 1741861639.2198145}},
'info': {}},
'fc491156b442836722612d1aa8a8c57e406447b6':
{'revisions': {'62e9e2659596c97cd1dd313d4394e947':
{'timestamp': 1740151900.394}},
'info': {
'settings':
{'arch': 'x86_64', 'build_type': 'Release',
'compiler': 'gcc', 'compiler.cppstd': '17',
'compiler.libcxx': 'libstdc++11',
'compiler.version': '11', 'os': 'Linux'},
'options': {'shared': 'True'}}}}}}}
}
recipes = pl.only_recipes()
assert recipes == {'foobar/0.1.0': {
'revisions': {'85eb0587a3c12b90216c72070e9eef3e': {'timestamp': 1740151190.975}}},
'qux/0.2.1': {'revisions': {
'71c3c11b98a6f2ae11f0f391f5e62e2b': {'timestamp': 1740151186.976}}}}
Loading