Fix for deriving base version for old setuptools
Old versions of setuptools return a tuple for their pkg_resources.parse_version method instead of a Version object with a base_version attribute that we can use to retrieve the base version. So some manually parsing is needed instead.
This commit is contained in:
parent
fe35086ad7
commit
1ab0a00700
1 changed files with 11 additions and 1 deletions
|
|
@ -575,7 +575,17 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
|||
|
||||
octoprint_version = pkg_resources.parse_version(octoprint_version_string)
|
||||
if base:
|
||||
octoprint_version = pkg_resources.parse_version(octoprint_version.base_version)
|
||||
if isinstance(octoprint_version, tuple):
|
||||
# old setuptools
|
||||
base_version = []
|
||||
for part in octoprint_version:
|
||||
if part.startswith("*"):
|
||||
break
|
||||
base_version.append(part)
|
||||
octoprint_version = tuple(base_version)
|
||||
else:
|
||||
# new setuptools
|
||||
octoprint_version = pkg_resources.parse_version(octoprint_version.base_version)
|
||||
return octoprint_version
|
||||
|
||||
def _to_external_representation(self, plugin):
|
||||
|
|
|
|||
Loading…
Reference in a new issue