diff --git a/src/calibre/gui2/update.py b/src/calibre/gui2/update.py index 9ce55d0..f9521d7 100644 --- a/src/calibre/gui2/update.py +++ b/src/calibre/gui2/update.py @@ -1,19 +1,17 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' -import re, binascii, cPickle, ssl, json +import binascii, cPickle from future_builtins import map from threading import Thread, Event from PyQt5.Qt import (QObject, pyqtSignal, Qt, QUrl, QDialog, QGridLayout, - QLabel, QCheckBox, QDialogButtonBox, QIcon) + QLabel, QDialogButtonBox, QIcon) -from calibre.constants import (__appname__, __version__, iswindows, isosx, +from calibre.constants import (__appname__, iswindows, isosx, isportable, is64bit, numeric_version) from calibre import prints, as_unicode -from calibre.utils.config import prefs -from calibre.utils.https import get_https_resource_securely -from calibre.gui2 import config, dynamic, open_url +from calibre.gui2 import dynamic, open_url from calibre.gui2.dialogs.plugin_updater import get_plugin_updates_available URL = 'https://code.calibre-ebook.com/latest' @@ -30,35 +28,7 @@ def get_download_url(): def get_newest_version(): - try: - icon_theme_name = json.loads(I('icon-theme.json', data=True))['name'] - except Exception: - icon_theme_name = '' - headers={ - 'CALIBRE-VERSION':__version__, - 'CALIBRE-OS': ('win' if iswindows else 'osx' if isosx else 'oth'), - 'CALIBRE-INSTALL-UUID': prefs['installation_uuid'], - 'CALIBRE-ICON-THEME': icon_theme_name, - } - try: - version = get_https_resource_securely(URL, headers=headers) - except ssl.SSLError as err: - if getattr(err, 'reason', None) != 'CERTIFICATE_VERIFY_FAILED': - raise - # certificate verification failed, since the version check contains no - # critical information, ignore and proceed - # We have to do this as if the calibre CA certificate ever - # needs to be revoked, then we wont be able to do version checks - version = get_https_resource_securely(URL, headers=headers, cacerts=None) - try: - version = version.decode('utf-8').strip() - except UnicodeDecodeError: - version = u'' - ans = NO_CALIBRE_UPDATE - m = re.match(ur'(\d+)\.(\d+).(\d+)$', version) - if m is not None: - ans = tuple(map(int, (m.group(1), m.group(2), m.group(3)))) - return ans + return NO_CALIBRE_UPDATE class Signal(QObject): @@ -81,12 +51,6 @@ class CheckForUpdates(Thread): calibre_update_version = NO_CALIBRE_UPDATE plugins_update_found = 0 try: - version = get_newest_version() - if version[:2] > numeric_version[:2]: - calibre_update_version = version - except Exception as e: - prints('Failed to check for calibre update:', as_unicode(e)) - try: update_plugins = get_plugin_updates_available(raise_error=True) if update_plugins is not None: plugins_update_found = len(update_plugins)