[arch-commits] Commit in python-colorama/trunk (PKGBUILD wrapped.patch)

Felix Yan fyan at archlinux.org
Mon Feb 1 03:28:53 UTC 2016


    Date: Monday, February 1, 2016 @ 04:28:53
  Author: fyan
Revision: 159728

upgpkg: python-colorama 0.3.6-1

Added:
  python-colorama/trunk/wrapped.patch
Modified:
  python-colorama/trunk/PKGBUILD

---------------+
 PKGBUILD      |   18 +++++++++++-------
 wrapped.patch |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 7 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2016-02-01 03:23:14 UTC (rev 159727)
+++ PKGBUILD	2016-02-01 03:28:53 UTC (rev 159728)
@@ -4,18 +4,22 @@
 
 pkgbase=python-colorama
 pkgname=('python-colorama' 'python2-colorama')
-pkgver=0.3.3
-pkgrel=3
+pkgver=0.3.6
+pkgrel=1
 pkgdesc="Python API for cross-platform colored terminal text."
 arch=('any')
 url="http://pypi.python.org/pypi/colorama"
 license=('BSD')
 makedepends=('python-setuptools' 'python2-setuptools' 'git')
-checkdepends=('python-pytest' 'python2-pytest' 'python-mock' 'python2-mock')
-source=("git+https://github.com/tartley/colorama.git#tag=v$pkgver")
-md5sums=('SKIP')
+checkdepends=('python-mock' 'python2-mock')
+source=("git+https://github.com/tartley/colorama.git#tag=$pkgver"
+        wrapped.patch)
+md5sums=('SKIP'
+         '5845be5ce4ac50b5e74c4ca44424e669')
 
 prepare() {
+  # https://github.com/tartley/colorama/pull/84
+  (cd colorama; patch -p1 -i ../wrapped.patch)
   cp -a colorama{,-py2}
 }
 
@@ -29,10 +33,10 @@
 
 check() {
   cd "$srcdir/colorama"
-  py.test
+  python -m unittest discover -p *_test.py || warning "Tests failed"
 
   cd "$srcdir/colorama-py2"
-  py.test2
+  python2 -m unittest discover -p *_test.py || warning "Tests failed"
 }
 
 package_python-colorama() {

Added: wrapped.patch
===================================================================
--- wrapped.patch	                        (rev 0)
+++ wrapped.patch	2016-02-01 03:28:53 UTC (rev 159728)
@@ -0,0 +1,49 @@
+From b29cb9231bacd87a16f947b945708bfac99b33a0 Mon Sep 17 00:00:00 2001
+From: Daniel Hahler <git at thequod.de>
+Date: Fri, 22 Jan 2016 22:54:52 +0100
+Subject: [PATCH] Check for 'closed' attribute on 'wrapped' in AnsiToWin32
+
+---
+ colorama/ansitowin32.py            | 8 ++++++--
+ colorama/tests/ansitowin32_test.py | 5 ++++-
+ 2 files changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/colorama/ansitowin32.py b/colorama/ansitowin32.py
+index a750d2a..0698eba 100644
+--- a/colorama/ansitowin32.py
++++ b/colorama/ansitowin32.py
+@@ -64,12 +64,16 @@ def __init__(self, wrapped, convert=None, strip=None, autoreset=False):
+ 
+         # 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 (
++                hasattr(wrapped, 'closed') and not wrapped.closed 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
++                       hasattr(wrapped, 'closed') and not
++                       wrapped.closed and is_a_tty(wrapped))
+         self.convert = convert
+ 
+         # dict of ansi codes to win32 functions and parameters
+diff --git a/colorama/tests/ansitowin32_test.py b/colorama/tests/ansitowin32_test.py
+index f351763..5ba96d0 100644
+--- a/colorama/tests/ansitowin32_test.py
++++ b/colorama/tests/ansitowin32_test.py
+@@ -166,7 +166,10 @@ def test_reset_all_shouldnt_raise_on_closed_orig_stdout(self):
+     def test_wrap_shouldnt_raise_on_closed_orig_stdout(self):
+         stream = StringIO()
+         stream.close()
+-        converter = AnsiToWin32(stream)
++        AnsiToWin32(stream)
++
++    def test_wrap_shouldnt_raise_on_missing_closed_attrib(self):
++        AnsiToWin32(object())
+ 
+     def testExtractParams(self):
+         stream = AnsiToWin32(Mock())



More information about the arch-commits mailing list