reassign 99837 dh-python
retitle 99837 dh-python: plugin_flit: requires-extra not filtered
tags 99837 patch
thanks

This appears to be a bug in dh-python (regression between
4.20201102+nmu1 [1] and 5.20211022.1 [2]). Reassigning it.

Debugging the issue, it seems this regression was created by commit
ed80cac5bde56d3c984aa833fa9bfcda8d726783.

I've attached a patch that fixes this bug, but I'm not sure it's up to
par with the dh-python code?

Better than no patch, but I'm not 100% sure I understand how the
testsuite works and sadly I currently don't have time to push further :)

Cheers,

[1]:
https://buildd.debian.org/status/fetch.php?pkg=python-mediafile&arch=all&ver=0.8.1-1&stamp=1634014915&raw=0

[2]:
https://buildd.debian.org/status/fetch.php?pkg=python-mediafile&arch=all&ver=0.8.1-2&stamp=1635714821&raw=0

-- 
  ⢀⣴⠾⠻⢶⣦⠀
  ⣾⠁⢠⠒⠀⣿⡁  Louis-Philippe Véronneau
  ⢿⡄⠘⠷⠚⠋   po...@debian.org / veronneau.org
  ⠈⠳⣄
From f3e65326fad9c8f4f83fae333045fb90d80c7831 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis-Philippe=20V=C3=A9ronneau?= <po...@debian.org>
Date: Sun, 21 Nov 2021 23:04:45 -0500
Subject: [PATCH] Filter requires-extra when parsing for dependencies in
 .dist-info files.

Closes: #99837
---
 dhpython/depends.py        | 3 ++-
 tests/tpb02/pyproject.toml | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/dhpython/depends.py b/dhpython/depends.py
index d00334b..f6983af 100644
--- a/dhpython/depends.py
+++ b/dhpython/depends.py
@@ -255,7 +255,8 @@ class Dependencies:
                     metadata = email.message_from_string(fp.read())
                 requires = metadata.get_all('Requires-Dist', [])
                 for req in requires:
-                    self.depend(guess_deps(req=req))
+                    if ";" not in req:  # filter for things like 'tox ; extra == "test"'
+                        self.depend(guess_deps(req=req))
 
         # add dependencies from --depends
         for item in options.depends or []:
diff --git a/tests/tpb02/pyproject.toml b/tests/tpb02/pyproject.toml
index 94ea7d0..ad9fc43 100644
--- a/tests/tpb02/pyproject.toml
+++ b/tests/tpb02/pyproject.toml
@@ -6,3 +6,8 @@ build-backend = "flit_core.buildapi"
 module = "foo"
 author = "Stefano Rivera"
 requires = ["toml"]
+
+[tool.flit.metadata.requires-extra]
+test = [
+    "tox"
+]
-- 
2.34.0

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to