1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
--- calibre-2.83.0/src/calibre/gui2/update.py.orig 2017-04-26 14:55:30.824093338 -0300
+++ calibre-2.83.0/src/calibre/gui2/update.py 2017-04-26 15:00:09.807495982 -0300
@@ -1,19 +1,17 @@
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
-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,
- isportable, is64bit, numeric_version)
+from calibre.constants import (__appname__, iswindows, isosx,
+ isportable, is64bit)
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_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 @@
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)
@@ -193,13 +157,7 @@
self.status_bar.update_label.setText(msg)
self.status_bar.update_label.setVisible(True)
- if has_calibre_update:
- if force:
- if not no_show_popup:
- self._update_notification__ = UpdateNotification(calibre_version,
- number_of_plugin_updates, parent=self)
- self._update_notification__.show()
- elif has_plugin_updates:
+ if has_plugin_updates:
if force:
from calibre.gui2.dialogs.plugin_updater import (PluginUpdaterDialog,
FILTER_UPDATE_AVAILABLE)
|