Date: Saturday, January 18, 2020 @ 15:59:55
  Author: anthraxx
Revision: 553034

upgpkg: python-terminaltables 3.1.0-7: add python 3.8 patch

Added:
  python-terminaltables/trunk/python-3.8.patch
Modified:
  python-terminaltables/trunk/PKGBUILD

------------------+
 PKGBUILD         |   15 ++++++++++-----
 python-3.8.patch |   26 ++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 5 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2020-01-18 15:21:28 UTC (rev 553033)
+++ PKGBUILD    2020-01-18 15:59:55 UTC (rev 553034)
@@ -4,7 +4,7 @@
 pkgname=python-terminaltables
 _pyname=terminaltables
 pkgver=3.1.0
-pkgrel=6
+pkgrel=7
 pkgdesc="Generate simple tables in terminals from a nested list of strings"
 arch=('any')
 url="https://github.com/Robpol86/terminaltables";
@@ -12,17 +12,22 @@
 depends=('python')
 makedepends=('python-setuptools')
 checkdepends=('python-pytest' 'python-colorama' 'python-termcolor' 
'python-colorclass')
-source=("${_pyname}-${pkgver}.tar.gz::https://github.com/Robpol86/${_pyname}/archive/v${pkgver}.tar.gz";)
-sha512sums=('dc49458652fff8bc6094d316d84c9b8e9fca1a26e3230c0b668bc03ec8528793f4ef024e8032d4a56fbfabfdfd4a1142870f550f0b373ba6a42dd2e3ead3f501')
+source=("${_pyname}-${pkgver}.tar.gz::https://github.com/Robpol86/${_pyname}/archive/v${pkgver}.tar.gz";
+        python-3.8.patch)
+sha512sums=('dc49458652fff8bc6094d316d84c9b8e9fca1a26e3230c0b668bc03ec8528793f4ef024e8032d4a56fbfabfdfd4a1142870f550f0b373ba6a42dd2e3ead3f501'
+            
'9a33ef51cbd2854bf9acc247e2d966332229446158e7dae9cad25e03335eb9689d50b0a22234285aa56c707e6e93c12f950299efcfbe7e42ed527216090592f2')
 
+prepare() {
+  cd ${_pyname}-${pkgver}
+  patch -Np1 < ../python-3.8.patch
+}
+
 build() {
-  msg2 "Building python..."
   cd ${_pyname}-${pkgver}
   python setup.py build
 }
 
 check() {
-  msg2 "Checking python..."
   cd ${_pyname}-${pkgver}
   py.test
 }

Added: python-3.8.patch
===================================================================
--- python-3.8.patch                            (rev 0)
+++ python-3.8.patch    2020-01-18 15:59:55 UTC (rev 553034)
@@ -0,0 +1,26 @@
+From dcd9ba5c1c35d986fabe1b3a529cf15d08875a33 Mon Sep 17 00:00:00 2001
+From: Carl Suster <[email protected]>
+Date: Tue, 12 Nov 2019 14:19:23 +1100
+Subject: [PATCH] Write bytes to underluing buffer of stdout
+
+This was adapted from an example in the python docs and solves test failures 
seen on the CI. We need to write to the underlying buffer object of the stream, 
but in case `sys.stdout` was replaced with a file-like object without a buffer 
there's a fallback to direct writing.
+---
+ terminaltables/terminal_io.py | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/terminaltables/terminal_io.py b/terminaltables/terminal_io.py
+index 8b8c10d..005da1b 100644
+--- a/terminaltables/terminal_io.py
++++ b/terminaltables/terminal_io.py
+@@ -94,5 +94,10 @@ def set_terminal_title(title, kernel32=None):
+             return kernel32.SetConsoleTitleW(title) != 0
+ 
+     # Linux/OSX.
+-    sys.stdout.write(b'\033]0;' + title_bytes + b'\007')
++    set_title = b'\033]0;' + title_bytes + b'\007'
++    if hasattr(sys.stdout, 'buffer'):
++        sys.stdout.buffer.write(set_title)
++    else:
++        text = set_title.decode(sys.stdout.encoding, 'strict')
++        sys.stdout.write(text)
+     return True

Reply via email to