Ignore a leading v or V in github release tags.

This fixes foosel/OctoPrint#1723 .

(cherry picked from commit f1c3829)
This commit is contained in:
Eyal Soha 2017-01-21 13:00:37 +01:00 committed by Gina Häußge
parent c8dfe363bc
commit 6b2f28240e
2 changed files with 6 additions and 0 deletions

View file

@ -667,6 +667,9 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
octoprint_version_string = octoprint_version_string[:octoprint_version_string.find("-")]
octoprint_version = pkg_resources.parse_version(octoprint_version_string)
# A leading v is common in github release tags and old setuptools doesn't remove it.
if octoprint_version and isinstance(octoprint_version, tuple) and octoprint_version[0].lower() == "*v":
octoprint_version = octoprint_version[1:]
if base:
if isinstance(octoprint_version, tuple):
# old setuptools

View file

@ -150,6 +150,9 @@ def _get_comparable_version_pkg_resources(version_string, force_base=True):
version = pkg_resources.parse_version(version_string)
# A leading v is common in github release tags and old setuptools doesn't remove it.
if version and isinstance(version, tuple) and version[0].lower() == "*v":
version = version[1:]
if force_base:
if isinstance(version, tuple):
# old setuptools