dev-python/colorama: upstream fix
authorAndrey Grozin <grozin@gentoo.org>
Tue, 23 Feb 2016 13:05:27 +0000 (19:05 +0600)
committerAndrey Grozin <grozin@gentoo.org>
Tue, 23 Feb 2016 13:05:27 +0000 (19:05 +0600)
https://github.com/tartley/colorama/commit/1244a00ae1accfeca3b4b1a85a3b718a920dd6bd

Package-Manager: portage-2.2.27

dev-python/colorama/colorama-0.3.6.ebuild
dev-python/colorama/files/colorama-0.3.6.patch [new file with mode: 0644]

index ae0dd9954b918f1b4973040287410496eaef1500..7cc88846d36bc741d4ae97ffdc36c3ffebaf6c61 100644 (file)
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-EAPI=5
+EAPI=6
 
 PYTHON_COMPAT=( python2_7 python3_{3,4,5} pypy pypy3 )
 
@@ -19,6 +19,8 @@ SLOT="0"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux"
 IUSE="examples"
 
+PATCHES=( "${FILESDIR}"/${P}.patch )
+
 python_install_all() {
        use examples && local EXAMPLES=( demos/. )
        distutils-r1_python_install_all
diff --git a/dev-python/colorama/files/colorama-0.3.6.patch b/dev-python/colorama/files/colorama-0.3.6.patch
new file mode 100644 (file)
index 0000000..65a9476
--- /dev/null
@@ -0,0 +1,32 @@
+diff -r -U2 colorama-0.3.6.orig/colorama/ansitowin32.py colorama-0.3.6/colorama/ansitowin32.py
+--- colorama-0.3.6.orig/colorama/ansitowin32.py        2015-12-14 09:09:52.000000000 +0100
++++ colorama-0.3.6/colorama/ansitowin32.py     2016-02-23 13:52:37.230415139 +0100
+@@ -14,4 +14,8 @@
++def is_stream_closed(stream):
++    return not hasattr(stream, 'closed') or stream.closed
++
++
+ def is_a_tty(stream):
+     return hasattr(stream, 'isatty') and stream.isatty()
+@@ -65,10 +69,10 @@
+         # should we strip ANSI sequences from our output?
+         if strip is None:
+-            strip = conversion_supported or (not wrapped.closed and not is_a_tty(wrapped))
++            strip = conversion_supported or (not is_stream_closed(wrapped) and not is_a_tty(wrapped))
+         self.strip = strip
+         # should we should convert ANSI sequences into win32 calls?
+         if convert is None:
+-            convert = conversion_supported and not wrapped.closed and is_a_tty(wrapped)
++            convert = conversion_supported and not is_stream_closed(wrapped) and is_a_tty(wrapped)
+         self.convert = convert
+@@ -146,5 +150,5 @@
+         if self.convert:
+             self.call_win32('m', (0,))
+-        elif not self.strip and not self.wrapped.closed:
++        elif not self.strip and not is_stream_closed(self.wrapped):
+             self.wrapped.write(Style.RESET_ALL)