From 04d2413426575d8dcffa0c5f8a2923a1aa7a6224cfbc1ee54a3f26d5bf35aa08 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Fri, 10 Sep 2021 07:49:18 +0000 Subject: [PATCH] - Add liberally-accept-charsets.patch: * Support multibyte utf8 return values with new versions of MariaDB. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mysqlclient?expand=0&rev=26 --- liberally-accept-charsets.patch | 23 +++++++++++++++++++++++ python-mysqlclient.changes | 6 ++++++ python-mysqlclient.spec | 4 +++- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 liberally-accept-charsets.patch diff --git a/liberally-accept-charsets.patch b/liberally-accept-charsets.patch new file mode 100644 index 0000000..0743cf4 --- /dev/null +++ b/liberally-accept-charsets.patch @@ -0,0 +1,23 @@ +Index: mysqlclient-2.0.3/tests/test_MySQLdb_capabilities.py +=================================================================== +--- mysqlclient-2.0.3.orig/tests/test_MySQLdb_capabilities.py ++++ mysqlclient-2.0.3/tests/test_MySQLdb_capabilities.py +@@ -189,12 +189,14 @@ VALUES (1, + with closing(connection_factory(**kwargs)) as conn: + with closing(conn.cursor()) as c: + c.execute("SELECT CHARSET(%s)", (MySQLdb.Binary(b"raw bytes"),)) +- self.assertEqual( +- c.fetchall()[0][0], "binary" if binary_prefix else "utf8" +- ) ++ res = ("utf8", "utf8mb3", "utf8mb4") ++ if binary_prefix: ++ self.assertEqual(c.fetchall()[0][0], "binary") ++ else: ++ self.assertIn(c.fetchall()[0][0], res) + # normal strings should not get prefix + c.execute("SELECT CHARSET(%s)", ("str",)) +- self.assertEqual(c.fetchall()[0][0], "utf8") ++ self.assertIn(c.fetchall()[0][0], res) + + + if __name__ == "__main__": diff --git a/python-mysqlclient.changes b/python-mysqlclient.changes index 43a9ccf..f272707 100644 --- a/python-mysqlclient.changes +++ b/python-mysqlclient.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Sep 10 07:48:36 UTC 2021 - Steve Kowalik + +- Add liberally-accept-charsets.patch: + * Support multibyte utf8 return values with new versions of MariaDB. + ------------------------------------------------------------------- Tue Mar 16 20:42:57 UTC 2021 - Matthias Fehring diff --git a/python-mysqlclient.spec b/python-mysqlclient.spec index 2f85698..7f46e8f 100644 --- a/python-mysqlclient.spec +++ b/python-mysqlclient.spec @@ -1,5 +1,5 @@ # -# spec file for package python-mysqlclient-test +# spec file # # Copyright (c) 2021 SUSE LLC # @@ -35,6 +35,7 @@ Summary: Python interface to MySQL License: GPL-2.0-or-later URL: https://github.com/PyMySQL/mysqlclient-python Source: https://files.pythonhosted.org/packages/source/m/mysqlclient/mysqlclient-%{version}.tar.gz +Patch0: liberally-accept-charsets.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -69,6 +70,7 @@ This package adds Python 3 support and bug fixes to MySQLdb1. %prep %setup -q -n mysqlclient-%{version} +%autopatch -p1 %build %if !%{with test}