Use vercodes in read_metadata interface

read_metadata is only called in read_app_args with an argument. As
vercodes is already there, drop the duplicate call.
This commit is contained in:
Jochen Sprickerhof 2022-07-19 13:41:24 +02:00
parent 8ab1d53318
commit 4d0a21f336
No known key found for this signature in database
GPG key ID: 5BFFDCC258E69433
2 changed files with 5 additions and 6 deletions

View file

@ -950,7 +950,7 @@ def read_app_args(appid_versionCode_pairs, allow_version_codes=False, sort_by_ti
""" """
vercodes = read_pkg_args(appid_versionCode_pairs, allow_version_codes) vercodes = read_pkg_args(appid_versionCode_pairs, allow_version_codes)
allapps = fdroidserver.metadata.read_metadata(appid_versionCode_pairs, sort_by_time) allapps = fdroidserver.metadata.read_metadata(vercodes, sort_by_time)
if not vercodes: if not vercodes:
return allapps return allapps

View file

@ -545,7 +545,7 @@ def read_srclibs():
srclibs[metadatapath.stem] = parse_yaml_srclib(metadatapath) srclibs[metadatapath.stem] = parse_yaml_srclib(metadatapath)
def read_metadata(appids={}, sort_by_time=False): def read_metadata(appid_to_vercode={}, sort_by_time=False):
"""Return a list of App instances sorted newest first. """Return a list of App instances sorted newest first.
This reads all of the metadata files in a 'data' repository, then This reads all of the metadata files in a 'data' repository, then
@ -553,7 +553,7 @@ def read_metadata(appids={}, sort_by_time=False):
sorted based on creation time, newest first. Most of the time, sorted based on creation time, newest first. Most of the time,
the newer files are the most interesting. the newer files are the most interesting.
appids is a dict with appids a keys and versionCodes as values. appid_to_vercode is a dict with appids a keys and versionCodes as values.
""" """
# Always read the srclibs before the apps, since they can use a srlib as # Always read the srclibs before the apps, since they can use a srlib as
@ -565,9 +565,8 @@ def read_metadata(appids={}, sort_by_time=False):
for basedir in ('metadata', 'tmp'): for basedir in ('metadata', 'tmp'):
Path(basedir).mkdir(exist_ok=True) Path(basedir).mkdir(exist_ok=True)
if appids: if appid_to_vercode:
vercodes = common.read_pkg_args(appids) metadatafiles = common.get_metadata_files(appid_to_vercode)
metadatafiles = common.get_metadata_files(vercodes)
else: else:
metadatafiles = list(Path('metadata').glob('*.yml')) + list( metadatafiles = list(Path('metadata').glob('*.yml')) + list(
Path('.').glob('.fdroid.yml') Path('.').glob('.fdroid.yml')