1 |
commit: 1b4109b06fe34ac39f3fc55996d66a9b6cc8d809 |
2 |
Author: Justin Lecher <jlec <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Dec 3 09:37:05 2015 +0000 |
4 |
Commit: Justin Lecher <jlec <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Dec 3 10:19:59 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b4109b0 |
7 |
|
8 |
dev-python/qrcode: Backport fix for Python3 |
9 |
|
10 |
Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=564930 |
11 |
|
12 |
Package-Manager: portage-2.2.25 |
13 |
Signed-off-by: Justin Lecher <jlec <AT> gentoo.org> |
14 |
|
15 |
dev-python/qrcode/files/qrcode-5.1-unicode.patch | 34 ++++++++++++++++++++++ |
16 |
.../{qrcode-5.1.ebuild => qrcode-5.1-r1.ebuild} | 6 +++- |
17 |
2 files changed, 39 insertions(+), 1 deletion(-) |
18 |
|
19 |
diff --git a/dev-python/qrcode/files/qrcode-5.1-unicode.patch b/dev-python/qrcode/files/qrcode-5.1-unicode.patch |
20 |
new file mode 100644 |
21 |
index 0000000..2d628c6 |
22 |
--- /dev/null |
23 |
+++ b/dev-python/qrcode/files/qrcode-5.1-unicode.patch |
24 |
@@ -0,0 +1,34 @@ |
25 |
+From 0a9f17d3afb0ff01f68c2276ec0844d329a6add9 Mon Sep 17 00:00:00 2001 |
26 |
+From: Chris Beaven <smileychris@×××××.com> |
27 |
+Date: Mon, 3 Nov 2014 10:56:14 -0600 |
28 |
+Subject: [PATCH] Fix script piping to stdout in Python 3 |
29 |
+ |
30 |
+Fixes #66 |
31 |
+--- |
32 |
+ qrcode/console_scripts.py | 13 ++++++++++++- |
33 |
+ 1 file changed, 12 insertions(+), 1 deletion(-) |
34 |
+ |
35 |
+diff --git a/qrcode/console_scripts.py b/qrcode/console_scripts.py |
36 |
+index d215993..c51463b 100755 |
37 |
+--- a/qrcode/console_scripts.py |
38 |
++++ b/qrcode/console_scripts.py |
39 |
+@@ -57,7 +57,18 @@ def main(args=sys.argv[1:]): |
40 |
+ return |
41 |
+ |
42 |
+ img = qr.make_image(image_factory=image_factory) |
43 |
+- img.save(sys.stdout) |
44 |
++ |
45 |
++ sys.stdout.flush() |
46 |
++ if sys.version_info[0] >= 3: |
47 |
++ buff = sys.stdout.buffer |
48 |
++ else: |
49 |
++ if sys.platform == 'win32': |
50 |
++ import os |
51 |
++ import msvcrt |
52 |
++ msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
53 |
++ buff = sys.stdout |
54 |
++ |
55 |
++ img.save(buff) |
56 |
+ |
57 |
+ |
58 |
+ if __name__ == "__main__": |
59 |
|
60 |
diff --git a/dev-python/qrcode/qrcode-5.1.ebuild b/dev-python/qrcode/qrcode-5.1-r1.ebuild |
61 |
similarity index 90% |
62 |
rename from dev-python/qrcode/qrcode-5.1.ebuild |
63 |
rename to dev-python/qrcode/qrcode-5.1-r1.ebuild |
64 |
index a9bbb7b..e97bd1c 100644 |
65 |
--- a/dev-python/qrcode/qrcode-5.1.ebuild |
66 |
+++ b/dev-python/qrcode/qrcode-5.1-r1.ebuild |
67 |
@@ -4,7 +4,7 @@ |
68 |
|
69 |
EAPI=5 |
70 |
|
71 |
-PYTHON_COMPAT=( python{2_7,3_3,3_4} ) |
72 |
+PYTHON_COMPAT=( python2_7 python3_{3,4,5} ) |
73 |
|
74 |
inherit distutils-r1 |
75 |
|
76 |
@@ -28,6 +28,10 @@ DEPEND=" |
77 |
test? ( ${RDEPEND} |
78 |
$(python_gen_cond_dep 'dev-python/mock[${PYTHON_USEDEP}]' python2_7) )" |
79 |
|
80 |
+PATCHES=( |
81 |
+ "${FILESDIR}"/${P}-unicode.patch |
82 |
+) |
83 |
+ |
84 |
python_test() { |
85 |
"${PYTHON}" -m unittest discover > /dev/tty | less || die "Testing failed with ${EPYTHON}" |
86 |
} |