From 2162b4f5970903d341a5a2294203477b44c01b07 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 26 Sep 2020 07:59:17 +0530 Subject: [PATCH] Plugin updater dialog should not break if an installed plugin incorrectly has a string based version number --- manual/customize.rst | 2 +- src/calibre/gui2/dialogs/plugin_updater.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/manual/customize.rst b/manual/customize.rst index 583180bdf3..c1767fd4b9 100644 --- a/manual/customize.rst +++ b/manual/customize.rst @@ -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 diff --git a/src/calibre/gui2/dialogs/plugin_updater.py b/src/calibre/gui2/dialogs/plugin_updater.py index d71a8c32e9..7df8ccbde4 100644 --- a/src/calibre/gui2/dialogs/plugin_updater.py +++ b/src/calibre/gui2/dialogs/plugin_updater.py @@ -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'+