[Pkg-privacy-commits] [torbrowser-launcher] 02/59: Use print_function from __future__
Roger Shimizu
rogershimizu at gmail.com
Mon Jan 29 13:43:56 UTC 2018
This is an automated email from the git hooks/post-receive script.
rosh pushed a commit to branch debian/sid
in repository torbrowser-launcher.
commit bace7de8fe389b7d42f45aa76648a85a5d74d2bb
Author: sedrubal <dev at sedrubal.de>
Date: Wed Nov 9 02:54:37 2016 +0100
Use print_function from __future__
To get compatible to python3
See #214
---
torbrowser_launcher/__init__.py | 10 ++++++----
torbrowser_launcher/common.py | 14 ++++++++------
torbrowser_launcher/launcher.py | 28 +++++++++++++++-------------
3 files changed, 29 insertions(+), 23 deletions(-)
diff --git a/torbrowser_launcher/__init__.py b/torbrowser_launcher/__init__.py
index a03d639..4541382 100644
--- a/torbrowser_launcher/__init__.py
+++ b/torbrowser_launcher/__init__.py
@@ -26,6 +26,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
"""
+from __future__ import print_function
+
import os, sys, argparse
from common import Common, SHARE
@@ -46,10 +48,10 @@ def main():
with open(os.path.join(SHARE, 'version')) as buf:
tor_browser_launcher_version = buf.read().strip()
- print _('Tor Browser Launcher')
- print _('By Micah Lee, licensed under MIT')
- print _('version {0}').format(tor_browser_launcher_version)
- print 'https://github.com/micahflee/torbrowser-launcher'
+ print(_('Tor Browser Launcher'))
+ print(_('By Micah Lee, licensed under MIT'))
+ print(_('version {0}').format(tor_browser_launcher_version))
+ print('https://github.com/micahflee/torbrowser-launcher')
common = Common(tor_browser_launcher_version)
diff --git a/torbrowser_launcher/common.py b/torbrowser_launcher/common.py
index 0dfd8da..c131053 100644
--- a/torbrowser_launcher/common.py
+++ b/torbrowser_launcher/common.py
@@ -26,6 +26,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
"""
+from __future__ import print_function
+
import os, sys, platform, subprocess, locale, pickle, json, psutil, re
import pygtk
@@ -180,17 +182,17 @@ class Common:
os.makedirs(path, 0700)
return True
except:
- print _("Cannot create directory {0}").format(path)
+ print(_("Cannot create directory {0}").format(path))
return False
if not os.access(path, os.W_OK):
- print _("{0} is not writable").format(path)
+ print(_("{0} is not writable").format(path))
return False
return True
# if gnupg_homedir isn't set up, set it up
def init_gnupg(self):
if not os.path.exists(self.paths['gnupg_homedir']):
- print _('Creating GnuPG homedir'), self.paths['gnupg_homedir']
+ print(_('Creating GnuPG homedir'), self.paths['gnupg_homedir'])
self.mkdir(self.paths['gnupg_homedir'])
self.import_keys()
@@ -237,12 +239,12 @@ class Common:
for key in keys:
imported = self.import_key_and_check_status(key)
if not imported:
- print _('Could not import key with fingerprint: %s.'
- % self.fingerprints[key])
+ print(_('Could not import key with fingerprint: %s.'
+ % self.fingerprints[key]))
all_imports_succeeded = False
if not all_imports_succeeded:
- print _('Not all keys were imported successfully!')
+ print(_('Not all keys were imported successfully!'))
return all_imports_succeeded
diff --git a/torbrowser_launcher/launcher.py b/torbrowser_launcher/launcher.py
index a24fa3e..660b302 100644
--- a/torbrowser_launcher/launcher.py
+++ b/torbrowser_launcher/launcher.py
@@ -26,6 +26,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
"""
+from __future__ import print_function
+
import os, subprocess, time, json, tarfile, hashlib, lzma, threading, re, unicodedata
from twisted.internet import reactor
from twisted.web.client import Agent, RedirectAgent, ResponseDone, ResponseFailed
@@ -72,7 +74,7 @@ class Launcher:
if self.common.settings['download_over_tor']:
try:
import txsocksx
- print _('Downloading over Tor')
+ print(_('Downloading over Tor'))
except ImportError:
md = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOSE, _("The python-txsocksx package is missing, downloads will not happen over tor"))
md.set_position(gtk.WIN_POS_CENTER)
@@ -89,7 +91,7 @@ class Launcher:
download_message = _("Your version of Tor Browser is out-of-date. Downloading and installing the newest version.")
# download and install
- print download_message
+ print(download_message)
self.set_gui('task', download_message,
['download_version_check',
'set_version',
@@ -252,14 +254,14 @@ class Launcher:
self.gui_task_i += 1
if task == 'download_version_check':
- print _('Downloading'), self.common.paths['version_check_url']
+ print(_('Downloading'), self.common.paths['version_check_url'])
self.download('version check', self.common.paths['version_check_url'], self.common.paths['version_check_file'])
if task == 'set_version':
version = self.get_stable_version()
if version:
self.common.build_paths(self.get_stable_version())
- print _('Latest version: {}').format(version)
+ print(_('Latest version: {}').format(version))
self.run_task()
else:
self.set_gui('error', _("Error detecting Tor Browser version."), [], False)
@@ -267,30 +269,30 @@ class Launcher:
self.build_ui()
elif task == 'download_sig':
- print _('Downloading'), self.common.paths['sig_url'].format(self.common.settings['mirror'])
+ print(_('Downloading'), self.common.paths['sig_url'].format(self.common.settings['mirror']))
self.download('signature', self.common.paths['sig_url'], self.common.paths['sig_file'])
elif task == 'download_tarball':
- print _('Downloading'), self.common.paths['tarball_url'].format(self.common.settings['mirror'])
+ print(_('Downloading'), self.common.paths['tarball_url'].format(self.common.settings['mirror']))
if not self.force_redownload and os.path.exists(self.common.paths['tarball_file']):
self.run_task()
else:
self.download('tarball', self.common.paths['tarball_url'], self.common.paths['tarball_file'])
elif task == 'verify':
- print _('Verifying signature')
+ print(_('Verifying signature'))
self.verify()
elif task == 'extract':
- print _('Extracting'), self.common.paths['tarball_filename']
+ print(_('Extracting'), self.common.paths['tarball_filename'])
self.extract()
elif task == 'run':
- print _('Running'), self.common.paths['tbb']['start']
+ print(_('Running'), self.common.paths['tbb']['start'])
self.run()
elif task == 'start_over':
- print _('Starting download over again')
+ print(_('Starting download over again'))
self.start_over()
def response_received(self, response):
@@ -346,11 +348,11 @@ class Launcher:
self.run_task()
else:
- print "FINISHED", msg
+ print("FINISHED", msg)
## FIXME handle errors
def download_error(self, f):
- print _("Download error:"), f.value, type(f.value)
+ print(_("Download error:"), f.value, type(f.value))
if isinstance(f.value, TryStableException):
f.trap(TryStableException)
@@ -546,7 +548,7 @@ class Launcher:
# don't run if it isn't at least the minimum version
if not self.check_min_version():
message = _("The version of Tor Browser you have installed is earlier than it should be, which could be a sign of an attack!")
- print message
+ print(message)
md = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOSE, _(message))
md.set_position(gtk.WIN_POS_CENTER)
--
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