public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Jason Donenfeld" <zx2c4@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/speedtest-cli/files/, net-analyzer/speedtest-cli/
Date: Wed, 24 Feb 2016 00:25:26 +0000 (UTC)	[thread overview]
Message-ID: <1456273515.fda9977267fc1afe379130af17048354a8fcd8a4.zx2c4@gentoo> (raw)

commit:     fda9977267fc1afe379130af17048354a8fcd8a4
Author:     Louis Sautier <sautier.louis <AT> gmail <DOT> com>
AuthorDate: Tue Feb 16 19:08:52 2016 +0000
Commit:     Jason Donenfeld <zx2c4 <AT> gentoo <DOT> org>
CommitDate: Wed Feb 24 00:25:15 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fda99772

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

 .../speedtest-cli-0.3.4-fix-unicode-py3.patch      | 36 ++++++++++++++++++++++
 ...-0.3.4.ebuild => speedtest-cli-0.3.4-r1.ebuild} |  2 ++
 2 files changed, 38 insertions(+)

diff --git a/net-analyzer/speedtest-cli/files/speedtest-cli-0.3.4-fix-unicode-py3.patch b/net-analyzer/speedtest-cli/files/speedtest-cli-0.3.4-fix-unicode-py3.patch
new file mode 100644
index 0000000..2bd809f
--- /dev/null
+++ b/net-analyzer/speedtest-cli/files/speedtest-cli-0.3.4-fix-unicode-py3.patch
@@ -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
+

diff --git a/net-analyzer/speedtest-cli/speedtest-cli-0.3.4.ebuild b/net-analyzer/speedtest-cli/speedtest-cli-0.3.4-r1.ebuild
similarity index 91%
rename from net-analyzer/speedtest-cli/speedtest-cli-0.3.4.ebuild
rename to net-analyzer/speedtest-cli/speedtest-cli-0.3.4-r1.ebuild
index a27f02d..444654d 100644
--- a/net-analyzer/speedtest-cli/speedtest-cli-0.3.4.ebuild
+++ b/net-analyzer/speedtest-cli/speedtest-cli-0.3.4-r1.ebuild
@@ -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


                 reply	other threads:[~2016-02-24  0:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456273515.fda9977267fc1afe379130af17048354a8fcd8a4.zx2c4@gentoo \
    --to=zx2c4@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox