File: commands_list_version_workaround.patch

package info (click to toggle)
python-pip 25.1.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 7,496 kB
  • sloc: python: 89,559; sh: 75; makefile: 25
file content (47 lines) | stat: -rw-r--r-- 1,639 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From: Scott Kitterman <scott@kitterman.com>
Date: Mon, 20 Apr 2020 10:59:54 -0700
Subject: Make sure pip's version parsing is always used

Bug-Debian: https://bugs.debian.org/912379
Origin: vendor
Bug: https://github.com/pypa/setuptools/issues/2052
Forwarded: https://github.com/pypa/setuptools/issues/2052
Last-Update: 2020-04-01

  * Patch command/list.py to round trip versions through string and back to
    versions to work around pip/setuptools incompatibility (Closes: #912379)
---
 src/pip/_internal/commands/list.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/pip/_internal/commands/list.py b/src/pip/_internal/commands/list.py
index b030850..b14b1db 100644
--- a/src/pip/_internal/commands/list.py
+++ b/src/pip/_internal/commands/list.py
@@ -33,6 +33,8 @@ if TYPE_CHECKING:
     _ProcessedDists = Sequence[_DistWithLatestInfo]
 
 
+from pip._vendor.packaging.version import parse
+
 logger = logging.getLogger(__name__)
 
 
@@ -209,7 +211,7 @@ class ListCommand(IndexGroupCommand):
         return [
             dist
             for dist in self.iter_packages_latest_infos(packages, options)
-            if dist.latest_version > dist.version
+            if parse(str(dist.latest_version)) > parse(str(dist.version))
         ]
 
     def get_uptodate(
@@ -218,7 +220,7 @@ class ListCommand(IndexGroupCommand):
         return [
             dist
             for dist in self.iter_packages_latest_infos(packages, options)
-            if dist.latest_version == dist.version
+            if parse(str(dist.latest_version)) == parse(str(dist.version))
         ]
 
     def get_not_required(