Hello community,
here is the log from the commit of package python-sqlparse for openSUSE:Factory
checked in at 2020-03-27 00:28:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-sqlparse (Old)
and /work/SRC/openSUSE:Factory/.python-sqlparse.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-sqlparse"
Fri Mar 27 00:28:45 2020 rev:10 rq:787620 version:0.3.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-sqlparse/python-sqlparse.changes
2020-03-11 18:49:23.523515141 +0100
+++
/work/SRC/openSUSE:Factory/.python-sqlparse.new.3160/python-sqlparse.changes
2020-03-27 00:28:45.396361938 +0100
@@ -1,0 +2,6 @@
+Tue Mar 24 02:45:39 UTC 2020 - Steve Kowalik <[email protected]>
+
+- Add stdout-encoding-set.patch to use sys.stdout.reconfigure() if
+ the stream is an instance of TextIOWrapper to support a pytest change.
+
+-------------------------------------------------------------------
New:
----
stdout-encoding-set.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-sqlparse.spec ++++++
--- /var/tmp/diff_new_pack.2L8sp7/_old 2020-03-27 00:28:45.876362181 +0100
+++ /var/tmp/diff_new_pack.2L8sp7/_new 2020-03-27 00:28:45.876362181 +0100
@@ -25,6 +25,7 @@
Group: Development/Languages/Python
URL: https://github.com/andialbrecht/sqlparse
Source:
https://files.pythonhosted.org/packages/source/s/sqlparse/sqlparse-%{version}.tar.gz
+Patch0: stdout-encoding-set.patch
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
@@ -42,6 +43,7 @@
%prep
%setup -q -n sqlparse-%{version}
sed -i -e '1{\,^#!%{_bindir}/env python,d}' sqlparse/__main__.py
sqlparse/cli.py
+%autopatch -p1
%build
%python_build
++++++ stdout-encoding-set.patch ++++++
Index: sqlparse-0.3.1/tests/test_cli.py
===================================================================
--- sqlparse-0.3.1.orig/tests/test_cli.py
+++ sqlparse-0.3.1/tests/test_cli.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
+import io
import subprocess
import sys
@@ -78,7 +79,10 @@ def test_script():
def test_encoding_utf8_stdout(filepath, load_file, capfd):
path = filepath('encoding_utf8.sql')
expected = load_file('encoding_utf8.sql', 'utf-8')
- sys.stdout.encoding = 'utf-8'
+ if isinstance(sys.stdout, io.TextIOWrapper):
+ sys.stdout.reconfigure(encoding='utf-8')
+ else:
+ sys.stdout.encoding = 'utf-8'
sqlparse.cli.main([path])
out, _ = capfd.readouterr()
assert out == expected
@@ -96,7 +100,10 @@ def test_encoding_utf8_output_file(filep
def test_encoding_gbk_stdout(filepath, load_file, capfd):
path = filepath('encoding_gbk.sql')
expected = load_file('encoding_gbk.sql', 'gbk')
- sys.stdout.encoding = 'gbk'
+ if isinstance(sys.stdout, io.TextIOWrapper):
+ sys.stdout.reconfigure(encoding='gbk')
+ else:
+ sys.stdout.encoding = 'gbk'
sqlparse.cli.main([path, '--encoding', 'gbk'])
out, _ = capfd.readouterr()
assert out == expected
@@ -117,7 +124,10 @@ def test_encoding_stdin_utf8(filepath, l
old_stdin = sys.stdin
with open(path, 'r') as f:
sys.stdin = f
- sys.stdout.encoding = 'utf-8'
+ if isinstance(sys.stdout, io.TextIOWrapper):
+ sys.stdout.reconfigure(encoding='utf-8')
+ else:
+ sys.stdout.encoding = 'utf-8'
sqlparse.cli.main(['-'])
sys.stdin = old_stdin
out, _ = capfd.readouterr()
@@ -130,7 +140,10 @@ def test_encoding_stdin_gbk(filepath, lo
old_stdin = sys.stdin
with open(path, 'r') as stream:
sys.stdin = stream
- sys.stdout.encoding = 'gbk'
+ if isinstance(sys.stdout, io.TextIOWrapper):
+ sys.stdout.reconfigure(encoding='gbk')
+ else:
+ sys.stdout.encoding = 'gbk'
sqlparse.cli.main(['-', '--encoding', 'gbk'])
sys.stdin = old_stdin
out, _ = capfd.readouterr()