🐛 Fix get_comparable_version
Apparently not all versions of pkg_resources have a release field on Version. So let's create that ourselves instead.
This commit is contained in:
1 parent
6f6dcdeef2
commit
6cfbf33d08
1 file changed
+7
-3
@@ -185,9 +185,13 @@ def get_comparable_version(version_string, cut=None, **kwargs):
|
||||
else:
|
||||
# new setuptools
|
||||
version = pkg_resources.parse_version(version.base_version)
|
||||
if 0 < cut < len(version.release):
|
||||
reduced = version.release[:-cut]
|
||||
version = pkg_resources.parse_version(".".join(str(x) for x in reduced))
|
||||
if cut is not None:
|
||||
parts = version.base_version.split(".")
|
||||
if 0 < cut < len(parts):
|
||||
reduced = parts[:-cut]
|
||||
version = pkg_resources.parse_version(
|
||||
".".join(str(x) for x in reduced)
|
||||
)
|
||||
|
||||
return version
|
||||
|
||||
|
||||
Reference in new issue
Block a user