Package: src:python-cliff
Version: 4.13.3-1
User: [email protected]
Usertags: python3.15
Tags: patch, ftbfs, forky, sid
Hi!
While rebuilding the python related packages against the Python 3.15rc1
version we found that python-cliff builds, but then causes
python-osc-lib to break [1].
This is because the `get_distributions_by_modules` function tries to
read the package metadata, and starting from Python 3.15 this operation
fails when the metadata isn't present (previously invalid reads returned
None). [2]
I've worked around this problem by returning an empty dictionary if the
values can't be read. This is not a proper fix, but simply ignoring data
that was already invalid.
I applied this fix in the sandbox [3] to be able to build the packages
that depend on python-cliff, please consider applying the patch to
support the upcoming 3.15 version.
Happy hacking,
[1]: https://debusine.debian.net/debian/r-python-python3.15/artifact/4582881/
[2]: https://docs.python.org/3.15/whatsnew/3.15.html#importlib-metadata
[3]: https://debusine.debian.net/debian/r-python-python3.15/
--
"Can you imagine what I would do if I could do all I can?" -- Sun Tzu
Saludos /\/\ /\ >< `/
Description: Gracefully handle metadata errors in packages_distributions
In Python 3.15, importlib.metadata.packages_distributions() raises
MetadataNotFound if any distribution directory on sys.path has missing or
incomplete metadata.
Author: Maximiliano Curia <[email protected]>
Forwarded: no
Index: python-cliff/cliff/command.py
===================================================================
--- python-cliff.orig/cliff/command.py
+++ python-cliff/cliff/command.py
@@ -42,7 +42,10 @@ def _get_distributions_by_modules() -> d
if _dists_by_mods is None:
# There can be multiple distribution in the case of namespace packages
# so we'll just grab the first one
- _dists_by_mods = {k: v[0] for k, v in packages_distributions().items()}
+ try:
+ _dists_by_mods = {k: v[0] for k, v in packages_distributions().items()}
+ except Exception:
+ _dists_by_mods = {}
return _dists_by_mods