Package: python-scooby
Version: 0.11.0-1
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu resolute ubuntu-patch

Dear Maintainer,

I have encountered an issue with tqdm package in Ubuntu
(https://launchpad.net/ubuntu/+source/tqdm/4.67.3-1)

It installs the following distinfo:
====
/usr/lib/python3/dist-packages/tqdm-4.67.3.dist-info
/usr/lib/python3/dist-packages/tqdm-4.67.3.dist-info/INSTALLER
/usr/lib/python3/dist-packages/tqdm-4.67.3.dist-info/METADATA
/usr/lib/python3/dist-packages/tqdm-4.67.3.dist-info/WHEEL
/usr/lib/python3/dist-packages/tqdm-4.67.3.dist-info/entry_points.txt
/usr/lib/python3/dist-packages/tqdm-4.67.3.dist-info/top_level.txt
/usr/lib/python3.14
/usr/lib/python3.14/dist-packages
/usr/lib/python3.14/dist-packages/tqdm-4.67.3.dist-info
/usr/lib/python3.14/dist-packages/tqdm-4.67.3.dist-info/INSTALLER
/usr/lib/python3.14/dist-packages/tqdm-4.67.3.dist-info/top_level.txt
====
Which I understand is the expected behaviour because the python debian helper
strips duplicate metadata.

Scooby uses the following code to retrieve package names:
https://github.com/banesullivan/scooby/blob/220e6464f5025a9c5bdbc52625f65fed5d3bd7de/scooby/report.py#L240:L243
    installed = sorted(
            (dist.metadata['Name'] for dist in distributions()),
            key=str.lower,
        )
It produces an exception if the distinfo does not contain the metadata file:
416s   File "/usr/lib/python3/dist-packages/scooby/report.py", line 376, in
__repr__
416s     repr_dict = self.to_dict()
416s   File "/usr/lib/python3/dist-packages/scooby/report.py", line 537, in
to_dict
416s     out['other'] = json.dumps(self.other_packages)
416s                               ^^^^^^^^^^^^^^^^^^^
416s   File "/usr/lib/python3/dist-packages/scooby/report.py", line 259, in
other_packages
416s     installed: dict[str, str] = self.installed_packages
416s                                 ^^^^^^^^^^^^^^^^^^^^^^^
416s   File "/usr/lib/python3/dist-packages/scooby/report.py", line 240, in
installed_packages
416s     installed = sorted(
416s         (dist.metadata['Name'] for dist in distributions()),
416s         key=str.lower,
416s     )
416s TypeError: descriptor 'lower' for 'str' objects doesn't apply to a
'NoneType' object

Since the code collects a list of package names, we can ignore the missing
metadata entries.

The attached patch can be applied to achieve the following:
  * d/p/ignore-empty-metadata.patch: Ignore dist-info with missing
    metadata when collecting the package list (LP: #2143273).

Thanks for considering the patch.


-- System Information:
Debian Release: forky/sid
  APT prefers questing-updates
  APT policy: (500, 'questing-updates'), (500, 'questing-security'), (500, 
'questing'), (100, 'questing-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.17.0-14-generic (SMP w/32 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru python-scooby-0.11.0/debian/patches/ignore-empty-metadata.patch 
python-scooby-0.11.0/debian/patches/ignore-empty-metadata.patch
--- python-scooby-0.11.0/debian/patches/ignore-empty-metadata.patch     
1970-01-01 12:00:00.000000000 +1200
+++ python-scooby-0.11.0/debian/patches/ignore-empty-metadata.patch     
2026-03-05 16:08:49.000000000 +1300
@@ -0,0 +1,19 @@
+Description: Ignore dist-info with the missing metadata
+ Python debian helper strips duplicate metadata, so
+ a version-specific dist-info may not have it available.
+Author: Vladimir Petko <[email protected]>
+Bug: https://github.com/banesullivan/scooby/issues/144
+Bug-Ubuntu: 
https://bugs.launchpad.net/ubuntu/+source/python-scooby/+bug/2143273
+Last-Update: 2026-03-05
+
+--- a/scooby/report.py
++++ b/scooby/report.py
+@@ -238,7 +238,7 @@
+         """
+         # sort case-insensitively by name
+         installed = sorted(
+-            (dist.metadata['Name'] for dist in distributions()),
++            (dist.name for dist in distributions() if dist.name),
+             key=str.lower,
+         )
+         packages: dict[str, str] = {}
diff -Nru python-scooby-0.11.0/debian/patches/series 
python-scooby-0.11.0/debian/patches/series
--- python-scooby-0.11.0/debian/patches/series  1970-01-01 12:00:00.000000000 
+1200
+++ python-scooby-0.11.0/debian/patches/series  2026-03-05 16:08:49.000000000 
+1300
@@ -0,0 +1 @@
+ignore-empty-metadata.patch

Reply via email to