[Pkg-privacy-commits] [torbrowser-launcher] 161/476: workaround for #57: RC version incorrectly detected as stable
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:21:33 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch debian
in repository torbrowser-launcher.
commit a8d83edfc8e6d2c8d6e4b9d82b25d53a971c2362
Author: boyska <piuttosto at logorroici.org>
Date: Sun Nov 3 18:01:23 2013 +0100
workaround for #57: RC version incorrectly detected as stable
---
torbrowser-launcher | 110 ++++++++++++++++++++++++++--------------------------
1 file changed, 56 insertions(+), 54 deletions(-)
diff --git a/torbrowser-launcher b/torbrowser-launcher
index 0fade97..210d2a2 100755
--- a/torbrowser-launcher
+++ b/torbrowser-launcher
@@ -84,11 +84,11 @@ class TBLCommon:
# initialize the app
self.available_versions = {
- 'stable': _('Tor Browser Bundle - stable'),
+ 'stable': _('Tor Browser Bundle - stable'),
'alpha': _('Tor Browser Bundle - alpha')
}
self.default_mirror = 'https://www.torproject.org/dist/'
-
+
self.discover_arch_lang()
self.build_paths()
self.mkdir(self.paths['data_dir'])
@@ -241,7 +241,7 @@ class TBLCommon:
self.mirrors = []
for mirror in open(self.paths['mirrors_txt'], 'r').readlines():
self.mirrors.append(mirror.strip())
-
+
# load settings
def load_settings(self):
default_settings = {
@@ -258,7 +258,7 @@ class TBLCommon:
'update_over_tor': True,
'check_for_updates': False,
'last_update_check_timestamp': 0,
- 'mirror': self.default_mirror
+ 'mirror': self.default_mirror
}
if os.path.isfile(self.paths['settings_file']):
@@ -338,7 +338,7 @@ class TBLCommon:
else:
if len(p.cmdline) > 0:
exe = p.cmdline[0]
-
+
if exe == bin_path:
pid = p.pid
@@ -376,7 +376,7 @@ class TBLSettings:
self.window.set_border_width(10)
self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy)
-
+
# build the rest of the UI
self.box = gtk.VBox(False, 10)
self.window.add(self.box)
@@ -425,9 +425,9 @@ class TBLSettings:
self.tor_update_checkbox = gtk.CheckButton(_("Download updates over Tor (recommended)"))
self.settings_box.pack_start(self.tor_update_checkbox, True, True, 0)
if self.common.settings['update_over_tor']:
- self.tor_update_checkbox.set_active(True)
+ self.tor_update_checkbox.set_active(True)
else:
- self.tor_update_checkbox.set_active(False)
+ self.tor_update_checkbox.set_active(False)
self.tor_update_checkbox.show()
"""
@@ -435,9 +435,9 @@ class TBLSettings:
self.update_checkbox = gtk.CheckButton(_("Check for updates next launch"))
self.settings_box.pack_start(self.update_checkbox, True, True, 0)
if self.common.settings['check_for_updates']:
- self.update_checkbox.set_active(True)
+ self.update_checkbox.set_active(True)
else:
- self.update_checkbox.set_active(False)
+ self.update_checkbox.set_active(False)
self.update_checkbox.show()
# labels
@@ -598,8 +598,8 @@ class TBLLauncher:
if check_for_updates:
# check for update
print 'Checking for update'
- self.set_gui('task', _("Checking for Tor Browser update."),
- ['download_update_check',
+ self.set_gui('task', _("Checking for Tor Browser update."),
+ ['download_update_check',
'attempt_update'])
else:
# no need to check for update
@@ -636,19 +636,19 @@ class TBLLauncher:
print _('TBB is out of date, attempting to upgrade to {0}'.format(latest_version))
# there is a tbb upgrade available
if latest_version >= '3.':
- self.set_gui('task', _("Your Tor Browser is out of date."),
- ['download_sha256',
+ self.set_gui('task', _("Your Tor Browser is out of date."),
+ ['download_sha256',
'download_sha256_sig',
- 'download_tarball',
+ 'download_tarball',
'verify',
'extract',
'run'])
else:
- self.set_gui('task', _("Your Tor Browser is out of date."),
- ['download_tarball_sig',
- 'download_tarball',
- 'verify',
- 'extract',
+ self.set_gui('task', _("Your Tor Browser is out of date."),
+ ['download_tarball_sig',
+ 'download_tarball',
+ 'verify',
+ 'extract',
'run'])
else:
# for some reason the installed tbb is newer than the current version?
@@ -658,21 +658,21 @@ class TBLLauncher:
else:
print _('TBB is not installed, attempting to install {0}'.format(latest_version))
if latest_version >= '3.':
- self.set_gui('task', _("Downloading and installing Tor Browser."),
- ['download_sha256',
+ self.set_gui('task', _("Downloading and installing Tor Browser."),
+ ['download_sha256',
'download_sha256_sig',
- 'download_tarball',
- 'verify',
- 'extract',
+ 'download_tarball',
+ 'verify',
+ 'extract',
'run'])
else:
- self.set_gui('task', _("Downloading and installing Tor Browser."),
- ['download_tarball_sig',
- 'download_tarball',
- 'verify',
- 'extract',
+ self.set_gui('task', _("Downloading and installing Tor Browser."),
+ ['download_tarball_sig',
+ 'download_tarball',
+ 'verify',
+ 'extract',
'run'])
-
+
# there are different GUIs that might appear, this sets which one we want
def set_gui(self, gui, message, tasks, autostart=True):
self.gui = gui
@@ -702,7 +702,7 @@ class TBLLauncher:
if 'error' in self.gui:
# labels
- self.label = gtk.Label( self.gui_message )
+ self.label = gtk.Label( self.gui_message )
self.label.set_line_wrap(True)
self.box.pack_start(self.label, True, True, 0)
self.label.show()
@@ -739,11 +739,11 @@ class TBLLauncher:
elif self.gui == 'task':
# label
- self.label = gtk.Label( self.gui_message )
+ self.label = gtk.Label( self.gui_message )
self.label.set_line_wrap(True)
self.box.pack_start(self.label, True, True, 0)
self.label.show()
-
+
# progress bar
self.progressbar = gtk.ProgressBar(adjustment=None)
self.progressbar.set_orientation(gtk.PROGRESS_LEFT_TO_RIGHT)
@@ -789,7 +789,7 @@ class TBLLauncher:
# start running tasks
self.run_task()
-
+
# run the next task in the task list
def run_task(self):
self.refresh_gtk()
@@ -799,7 +799,7 @@ class TBLLauncher:
return
task = self.gui_tasks[self.gui_task_i]
-
+
# get ready for the next task
self.gui_task_i += 1
@@ -807,7 +807,7 @@ class TBLLauncher:
if task == 'download_update_check':
print _('Downloading'), self.common.paths['update_check_url']
self.download('update check', self.common.paths['update_check_url'], self.common.paths['update_check_file'])
-
+
if task == 'attempt_update':
print _('Checking to see if update is needed')
self.attempt_update()
@@ -839,7 +839,7 @@ class TBLLauncher:
elif task == 'run':
print _('Running'), self.common.paths['tbb'][self.common.settings['preferred']]['start']
self.run()
-
+
elif task == 'start_over':
print _('Starting download over again')
self.start_over()
@@ -859,7 +859,7 @@ class TBLLauncher:
if response.code == 404:
if common.settings['preferred'] == 'alpha' and common.language != 'en-US':
try_stable = True
-
+
if try_stable:
raise TryStableException(_("It looks like the alpha version of Tor Browser Bundle isn't available for your language. Would you like to try the stable version instead?"))
else:
@@ -888,7 +888,7 @@ class TBLLauncher:
self.all_done(reason)
dl = FileDownloader(self.common, self.file_download, response.length, self.progressbar, self.response_finished)
- response.deliverBody(dl)
+ response.deliverBody(dl)
def response_finished(self, msg):
if msg.check(ResponseDone):
@@ -908,15 +908,15 @@ class TBLLauncher:
if isinstance(f.value, TryStableException):
f.trap(TryStableException)
self.set_gui('error_try_stable', str(f.value), [], False)
-
+
elif isinstance(f.value, TryDefaultMirrorException):
f.trap(TryDefaultMirrorException)
self.set_gui('error_try_default_mirror', str(f.value), [], False)
-
+
elif isinstance(f.value, DownloadErrorException):
f.trap(DownloadErrorException)
self.set_gui('error', str(f.value), [], False)
-
+
elif isinstance(f.value, DNSLookupError):
f.trap(DNSLookupError)
if common.settings['mirror'] != common.default_mirror:
@@ -935,7 +935,7 @@ class TBLLauncher:
else:
self.set_gui('error', _("Error starting download:\n\n{0}\n\nAre you connected to the internet?").format(f.value), [], False)
-
+
self.build_ui()
def download(self, name, url, path):
@@ -944,11 +944,11 @@ class TBLLauncher:
# initialize the progress bar
mirror_url = url.format(self.common.settings['mirror'])
- self.progressbar.set_fraction(0)
+ self.progressbar.set_fraction(0)
self.progressbar.set_text(_('Downloading {0}').format(name))
self.progressbar.show()
self.refresh_gtk()
-
+
# default mirror gets certificate pinning, only for requests that use the mirror
if self.common.settings['mirror'] == self.common.default_mirror and '{0}' in url:
agent = Agent(reactor, VerifyTorProjectCert(self.common.paths['torproject_pem']))
@@ -962,10 +962,10 @@ class TBLLauncher:
d = agent.request('GET', mirror_url,
Headers({'User-Agent': ['torbrowser-launcher']}),
None)
-
+
self.file_download = open(path, 'w')
d.addCallback(self.response_received).addErrback(self.download_error)
-
+
if not reactor.running:
reactor.run()
@@ -1002,7 +1002,9 @@ class TBLLauncher:
valid_stables = []
for version in versions:
if str(version).find('-Linux') != -1:
- if version.find('alpha') != -1 or version.find('beta') != -1:
+ if '-rc' in version:
+ continue
+ if 'alpha' in version or 'beta' in version:
valid_alphas.append(str(version))
else:
valid_stables.append(str(version))
@@ -1027,7 +1029,7 @@ class TBLLauncher:
else:
# failed to find the latest version
self.set_gui('error', _("Error checking for updates."), [], False)
-
+
except:
# not a valid JSON object
self.set_gui('error', _("Error checking for updates."), [], False)
@@ -1040,7 +1042,7 @@ class TBLLauncher:
latest_version = self.common.settings['latest_version'][self.common.settings['preferred']]
# initialize the progress bar
- self.progressbar.set_fraction(0)
+ self.progressbar.set_fraction(0)
self.progressbar.set_text(_('Verifying Signature'))
self.progressbar.show()
@@ -1062,7 +1064,7 @@ class TBLLauncher:
self.pulse_until_process_exits(p)
if p.returncode == 0:
verified = True
-
+
if verified:
self.run_task()
else:
@@ -1076,7 +1078,7 @@ class TBLLauncher:
def extract(self):
# initialize the progress bar
- self.progressbar.set_fraction(0)
+ self.progressbar.set_fraction(0)
self.progressbar.set_text(_('Installing'))
self.progressbar.show()
self.refresh_gtk()
@@ -1128,7 +1130,7 @@ class TBLLauncher:
self.gui_tasks = ['download_tarball', 'download_tarball_sig', 'verify', 'extract', 'run']
self.gui_task_i = 0
self.start(None)
-
+
# refresh gtk
def refresh_gtk(self):
while gtk.events_pending():
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/torbrowser-launcher.git
More information about the Pkg-privacy-commits
mailing list