Plugin updater dialog should not break if an installed plugin incorrectly has a string based version number

This commit is contained in:
Kovid Goyal 2020-09-26 07:59:17 +05:30
parent 8774db35fd
commit 2162b4f597
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 2 deletions

View File

@ -41,7 +41,7 @@ Environment variables
* ``CALIBRE_SHOW_DEPRECATION_WARNINGS`` - Causes calibre to print deprecation warnings to stdout. Useful for calibre developers.
* ``CALIBRE_NO_DEFAULT_PROGRAMS`` - Prevent calibre from automatically registering the filetypes it is capable of handling with Windows.
* ``CALIBRE_USE_DARK_PALETTE`` - Set it to ``1`` to have calibre use dark colors and ``0`` for normal colors (ignored on macOS).
On Windows 10 in the absence of this variable, the windows system preference for dark colors is used.
On Windows 10 in the absence of this variable, the Windows system preference for dark colors is used.
* ``SYSFS_PATH`` - Use if sysfs is mounted somewhere other than /sys
* ``http_proxy``, ``https_proxy`` - Used on Linux to specify an HTTP(S) proxy

View File

@ -224,6 +224,8 @@ class DisplayPlugin(object):
return filter_text in icu_lower(self.name) # case-insensitive filtering
def is_upgrade_available(self):
if isinstance(self.installed_version, str):
return True
return self.is_installed() and (self.installed_version < self.available_version or self.is_deprecated)
def is_valid_platform(self):
@ -414,7 +416,11 @@ class DisplayPluginModel(QAbstractTableModel):
if display_plugin.installed_version is None:
return (_('You can install this plugin')+'\n\n'+
_('Right-click to see more options'))
if display_plugin.installed_version < display_plugin.available_version:
try:
if display_plugin.installed_version < display_plugin.available_version:
return (_('A new version of this plugin is available')+'\n\n'+
_('Right-click to see more options'))
except Exception:
return (_('A new version of this plugin is available')+'\n\n'+
_('Right-click to see more options'))
return (_('This plugin is installed and up-to-date')+'\n\n'+