mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
net-analyzer/speedtest-cli: Fix output with Python 3
Upstream will not fix this until the next release https://github.com/sivel/speedtest-cli/pull/233 Package-Manager: portage-2.2.27
This commit is contained in:
committed by
Jason A. Donenfeld
parent
e01e965af1
commit
fda9977267
@@ -0,0 +1,36 @@
|
||||
diff --git a/speedtest_cli.py b/speedtest_cli.py
|
||||
index d93d5c3..930e42b 100755
|
||||
--- a/speedtest_cli.py
|
||||
+++ b/speedtest_cli.py
|
||||
@@ -108,6 +108,8 @@ except ImportError:
|
||||
def write(data):
|
||||
if not isinstance(data, basestring):
|
||||
data = str(data)
|
||||
+ if isinstance(data, unicode):
|
||||
+ data = data.encode('utf-8', 'ignore')
|
||||
fp.write(data)
|
||||
|
||||
want_unicode = False
|
||||
@@ -635,7 +637,7 @@ def speedtest():
|
||||
line = ('%(id)4s) %(sponsor)s (%(name)s, %(country)s) '
|
||||
'[%(d)0.2f km]' % server)
|
||||
serverList.append(line)
|
||||
- print_('\n'.join(serverList).encode('utf-8', 'ignore'))
|
||||
+ print_('\n'.join(serverList))
|
||||
sys.exit(0)
|
||||
else:
|
||||
servers = closestServers(config['client'])
|
||||
@@ -703,8 +705,8 @@ def speedtest():
|
||||
best = getBestServer(servers)
|
||||
|
||||
if not args.simple:
|
||||
- print_(('Hosted by %(sponsor)s (%(name)s) [%(d)0.2f km]: '
|
||||
- '%(latency)s ms' % best).encode('utf-8', 'ignore'))
|
||||
+ print_('Hosted by %(sponsor)s (%(name)s) [%(d)0.2f km]: '
|
||||
+ '%(latency)s ms' % best)
|
||||
else:
|
||||
print_('Ping: %(latency)s ms' % best)
|
||||
|
||||
--
|
||||
2.7.1
|
||||
|
||||
@@ -21,6 +21,8 @@ DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
|
||||
|
||||
DOCS=( CONTRIBUTING.md README.rst )
|
||||
|
||||
PATCHES=( "${FILESDIR}/${PN}-0.3.4-fix-unicode-py3.patch" )
|
||||
|
||||
python_install_all() {
|
||||
doman ${PN}.1
|
||||
distutils-r1_python_install_all
|
||||
Reference in New Issue
Block a user