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 27b15d7..10720b2 100644
--- a/src/pip/_internal/commands/list.py
+++ b/src/pip/_internal/commands/list.py
@@ -31,6 +31,8 @@ if MYPY_CHECK_RUNNING:
 
     from pip._internal.network.session import PipSession
 
+from pip._vendor.packaging.version import parse
+
 logger = logging.getLogger(__name__)
 
 
@@ -181,14 +183,14 @@ class ListCommand(IndexGroupCommand):
         # type: (List[Distribution], Values) -> List[Distribution]
         return [
             dist for dist in self.iter_packages_latest_infos(packages, options)
-            if dist.latest_version > dist.parsed_version
+            if parse(str(dist.latest_version)) > parse(str(dist.parsed_version))
         ]
 
     def get_uptodate(self, packages, options):
         # type: (List[Distribution], Values) -> List[Distribution]
         return [
             dist for dist in self.iter_packages_latest_infos(packages, options)
-            if dist.latest_version == dist.parsed_version
+            if parse(str(dist.latest_version)) == parse(str(dist.parsed_version))
         ]
 
     def get_not_required(self, packages, options):
