summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Lecher <jlec@gentoo.org>2015-12-03 10:37:05 +0100
committerJustin Lecher <jlec@gentoo.org>2015-12-03 11:19:59 +0100
commit1b4109b06fe34ac39f3fc55996d66a9b6cc8d809 (patch)
treea964f0dc457a9e1830f379e2952eb3793784c93c /dev-python/qrcode
parentdev-python/qrcode: Drop old (diff)
downloadgentoo-1b4109b06fe34ac39f3fc55996d66a9b6cc8d809.tar.gz
gentoo-1b4109b06fe34ac39f3fc55996d66a9b6cc8d809.tar.bz2
gentoo-1b4109b06fe34ac39f3fc55996d66a9b6cc8d809.zip
dev-python/qrcode: Backport fix for Python3
Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=564930 Package-Manager: portage-2.2.25 Signed-off-by: Justin Lecher <jlec@gentoo.org>
Diffstat (limited to 'dev-python/qrcode')
-rw-r--r--dev-python/qrcode/files/qrcode-5.1-unicode.patch34
-rw-r--r--dev-python/qrcode/qrcode-5.1-r1.ebuild (renamed from dev-python/qrcode/qrcode-5.1.ebuild)6
2 files changed, 39 insertions, 1 deletions
diff --git a/dev-python/qrcode/files/qrcode-5.1-unicode.patch b/dev-python/qrcode/files/qrcode-5.1-unicode.patch
new file mode 100644
index 000000000000..2d628c68e5a6
--- /dev/null
+++ b/dev-python/qrcode/files/qrcode-5.1-unicode.patch
@@ -0,0 +1,34 @@
+From 0a9f17d3afb0ff01f68c2276ec0844d329a6add9 Mon Sep 17 00:00:00 2001
+From: Chris Beaven <smileychris@gmail.com>
+Date: Mon, 3 Nov 2014 10:56:14 -0600
+Subject: [PATCH] Fix script piping to stdout in Python 3
+
+Fixes #66
+---
+ qrcode/console_scripts.py | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/qrcode/console_scripts.py b/qrcode/console_scripts.py
+index d215993..c51463b 100755
+--- a/qrcode/console_scripts.py
++++ b/qrcode/console_scripts.py
+@@ -57,7 +57,18 @@ def main(args=sys.argv[1:]):
+ return
+
+ img = qr.make_image(image_factory=image_factory)
+- img.save(sys.stdout)
++
++ sys.stdout.flush()
++ if sys.version_info[0] >= 3:
++ buff = sys.stdout.buffer
++ else:
++ if sys.platform == 'win32':
++ import os
++ import msvcrt
++ msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
++ buff = sys.stdout
++
++ img.save(buff)
+
+
+ if __name__ == "__main__":
diff --git a/dev-python/qrcode/qrcode-5.1.ebuild b/dev-python/qrcode/qrcode-5.1-r1.ebuild
index a9bbb7b55022..e97bd1cf63d4 100644
--- a/dev-python/qrcode/qrcode-5.1.ebuild
+++ b/dev-python/qrcode/qrcode-5.1-r1.ebuild
@@ -4,7 +4,7 @@
EAPI=5
-PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+PYTHON_COMPAT=( python2_7 python3_{3,4,5} )
inherit distutils-r1
@@ -28,6 +28,10 @@ DEPEND="
test? ( ${RDEPEND}
$(python_gen_cond_dep 'dev-python/mock[${PYTHON_USEDEP}]' python2_7) )"
+PATCHES=(
+ "${FILESDIR}"/${P}-unicode.patch
+)
+
python_test() {
"${PYTHON}" -m unittest discover > /dev/tty | less || die "Testing failed with ${EPYTHON}"
}