Skip to content
Merged
Changes from all commits
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
7 changes: 2 additions & 5 deletions doc/sphinxext/related_software.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ def _get_mapping(packages):


@functools.lru_cache
def _get_packages() -> dict[str, str]:
def _get_packages() -> tuple[dict[str, dict], dict[str, tuple]]:
try:
packages = _get_installer_packages()
except urllib.error.URLError as exc: # e.g., bad internet connection
if not REQUIRE_METADATA:
sphinx_logger.warning(f"Could not fetch package list, got: {exc}")
return dict()
return dict(), dict()
raise
# There can be duplicates in manual and installer packages because some of the
# PyPI entries for installer packages are incorrect or unusable (see above), so
Expand All @@ -186,7 +186,6 @@ def _get_packages() -> dict[str, str]:
packages = sorted(packages, key=lambda x: x.lower())
out = dict()
reasons = []
assert "fsleyes" in packages
for package in status_iterator(
packages, f"Adding {len(packages)} related software packages: "
):
Expand All @@ -197,15 +196,13 @@ def _get_packages() -> dict[str, str]:
else:
md = importlib.metadata.metadata(package)
except importlib.metadata.PackageNotFoundError:
assert "fsleyes" != package
reasons.append(f"{package}: not found, needs to be installed")
continue # raise a complete error later
else:
# Every project should really have this
do_continue = False
for key in ("Summary",):
if key not in md:
assert "fsleyes" != package
reasons.extend(f"{package}: missing {repr(key)}")
do_continue = True
if do_continue:
Expand Down
Loading