Use UM.Version instead of VersionTools

This commit is contained in:
Ian Paschal 2018-04-20 11:25:39 +02:00
parent 921e8f7602
commit fbf73176d3
2 changed files with 4 additions and 6 deletions

View file

@ -12,9 +12,7 @@ from PyQt5.QtCore import pyqtSlot, QObject, pyqtSignal
from UM.Logger import Logger from UM.Logger import Logger
from UM.Resources import Resources from UM.Resources import Resources
from UM.Version import Version
from cura.Utils import VersionTools
class CuraPackageManager(QObject): class CuraPackageManager(QObject):
@ -186,7 +184,7 @@ class CuraPackageManager(QObject):
# Compare versions and only schedule the installation if the given package is newer # Compare versions and only schedule the installation if the given package is newer
new_version = package_info["package_version"] new_version = package_info["package_version"]
installed_version = installed_package_info["package_version"] installed_version = installed_package_info["package_version"]
if VersionTools.compareSemanticVersions(new_version, installed_version) > 0: if Version(new_version) > Version(installed_version):
Logger.log("i", "Package [%s] version [%s] is newer than the installed version [%s], update it.", Logger.log("i", "Package [%s] version [%s] is newer than the installed version [%s], update it.",
package_id, new_version, installed_version) package_id, new_version, installed_version)
to_install_package = True to_install_package = True

View file

@ -16,7 +16,7 @@ from UM.PluginRegistry import PluginRegistry
from UM.Qt.Bindings.PluginsModel import PluginsModel from UM.Qt.Bindings.PluginsModel import PluginsModel
from UM.Extension import Extension from UM.Extension import Extension
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
from cura.Utils.VersionTools import compareSemanticVersions from UM.Version import Version
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from .AuthorsModel import AuthorsModel from .AuthorsModel import AuthorsModel
@ -289,7 +289,7 @@ class Toolbox(QObject, Extension):
local_version = local_package["package_version"] local_version = local_package["package_version"]
remote_version = remote_package["package_version"] remote_version = remote_package["package_version"]
return compareSemanticVersions(remote_version, local_version) > 0 return Version(remote_version) > Version(local_version)
@pyqtSlot(str, result = bool) @pyqtSlot(str, result = bool)
def isInstalled(self, package_id) -> bool: def isInstalled(self, package_id) -> bool: