Extensions: simplify access to manifests when refreshing the remote
The internal API call to refresh remote data wasn't returning the resulting data, making it inconvenient to refresh & access remote meta-data from a single repository.
This commit is contained in:
parent
2dd339bff3
commit
04f310a19a
@ -145,23 +145,10 @@ def repo_stats_calc_outdated_for_repo_directory(repo_directory):
|
||||
if pkg_manifest_local is None:
|
||||
return 0
|
||||
|
||||
# pylint: disable-next=using-constant-test
|
||||
if False:
|
||||
# TODO: support this, currently creating this data involves a conversion which isn't free.
|
||||
# This can probably be done once and cached, but for now use another function that provides this.
|
||||
pkg_manifest_remote = repo_cache_store.refresh_remote_from_directory(
|
||||
directory=repo_directory,
|
||||
error_fn=print,
|
||||
)
|
||||
else:
|
||||
pkg_manifest_remote = None
|
||||
for pkg_manifest_remote_test in repo_cache_store.pkg_manifest_from_remote_ensure(
|
||||
error_fn=print,
|
||||
ignore_missing=True,
|
||||
directory_subset=[repo_directory],
|
||||
):
|
||||
pkg_manifest_remote = pkg_manifest_remote_test
|
||||
break
|
||||
pkg_manifest_remote = repo_cache_store.refresh_remote_from_directory(
|
||||
directory=repo_directory,
|
||||
error_fn=print,
|
||||
)
|
||||
|
||||
if pkg_manifest_remote is None:
|
||||
return 0
|
||||
|
@ -1627,7 +1627,7 @@ class _RepoCacheEntry:
|
||||
*,
|
||||
error_fn: Callable[[Exception], None],
|
||||
force: bool = False,
|
||||
) -> None:
|
||||
) -> Optional[Dict[str, PkgManifest_Normalized]]:
|
||||
data = self._pkg_manifest_remote_data_source.data(
|
||||
cache_validate=True,
|
||||
force=force,
|
||||
@ -1641,6 +1641,8 @@ class _RepoCacheEntry:
|
||||
if pkg_manifest_remote is not self._pkg_manifest_remote:
|
||||
self._pkg_manifest_remote = pkg_manifest_remote
|
||||
|
||||
return pkg_manifest_remote
|
||||
|
||||
def pkg_manifest_from_local_ensure(
|
||||
self,
|
||||
*,
|
||||
@ -1764,11 +1766,10 @@ class RepoCacheStore:
|
||||
*,
|
||||
error_fn: Callable[[Exception], None],
|
||||
force: bool = False,
|
||||
) -> None:
|
||||
) -> Optional[Dict[str, PkgManifest_Normalized]]:
|
||||
for repo_entry in self._repos:
|
||||
if directory == repo_entry.directory:
|
||||
repo_entry._json_data_refresh(force=force, error_fn=error_fn)
|
||||
return
|
||||
return repo_entry._json_data_refresh(force=force, error_fn=error_fn)
|
||||
raise ValueError("Directory {:s} not a known repo".format(directory))
|
||||
|
||||
def refresh_local_from_directory(
|
||||
|
Loading…
Reference in New Issue
Block a user