commands: debug: Use packaging.version.parse to compare

This commit is contained in:
Noah Gorny 2021-01-16 17:59:18 +02:00
parent aa089883a8
commit c09bc1432b
2 changed files with 3 additions and 1 deletions

1
news/9461.bugfix.rst Normal file
View File

@ -0,0 +1 @@
commands: debug: Use packaging.version.parse to compare between versions.

View File

@ -6,6 +6,7 @@ import sys
import pip._vendor
from pip._vendor import pkg_resources
from pip._vendor.certifi import where
from pip._vendor.packaging.version import parse as parse_version
from pip import __file__ as pip_location
from pip._internal.cli import cmdoptions
@ -100,7 +101,7 @@ def show_actual_vendor_versions(vendor_txt_versions):
extra_message = ' (Unable to locate actual module version, using'\
' vendor.txt specified version)'
actual_version = expected_version
elif actual_version != expected_version:
elif parse_version(actual_version) != parse_version(expected_version):
extra_message = ' (CONFLICT: vendor.txt suggests version should'\
' be {})'.format(expected_version)
logger.info('%s==%s%s', module_name, actual_version, extra_message)