Fix python version detection on Debian testing/unstable

The current 2.7 Python binary on Debian returns "2.7.15+" as its version, which
is not PEP440 compliant. Tthere is no feedback at all from Debian maintainers
regarding the bug report as of now:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914072

This patch makes sure to drop any trailing '+' character in a version string.

Fixes #3049
This commit is contained in:
Robert Griebl committed 2019-02-18 00:37:08 +01:00
1 parent 8ce2290d63
commit c35708a422
1 file changed
+4
+4
View File
@@ -121,6 +121,10 @@ def get_comparable_version(version_string, base=False):
if "-" in version_string:
version_string = version_string[:version_string.find("-")]
# Debian has the python version set to 2.7.15+ which is not PEP440 compliant (bug 914072)
if version_string.endswith("+"):
version_string = version_string[:-1]
version = pkg_resources.parse_version(version_string)
# A leading v is common in github release tags and old setuptools doesn't remove it.