From 6e1f11c306d2ec608ba25f45b577791950cacd0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sloup?= Date: Tue, 18 Apr 2023 02:28:57 +0200 Subject: [PATCH] Rebase to the newest version Remove the PyUnicode_AsUTF8String Patch file, as it is already merged in upstream Change packaged files to match new setup.py requirements --- .gitignore | 1 + pyodbc-4.0.30-PyUnicode_AsUTF8String.patch | 103 --------------------- pyodbc.spec | 21 +++-- sources | 2 +- 4 files changed, 16 insertions(+), 111 deletions(-) delete mode 100644 pyodbc-4.0.30-PyUnicode_AsUTF8String.patch diff --git a/.gitignore b/.gitignore index 06c8406..bf0a2cd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ pyodbc-2.1.5.zip /pyodbc-3.0.10.tar.gz /pyodbc-4.0.27.tar.gz /pyodbc-4.0.30.tar.gz +/pyodbc-4.0.39.tar.gz diff --git a/pyodbc-4.0.30-PyUnicode_AsUTF8String.patch b/pyodbc-4.0.30-PyUnicode_AsUTF8String.patch deleted file mode 100644 index a2592fa..0000000 --- a/pyodbc-4.0.30-PyUnicode_AsUTF8String.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 3a8a947e41ae1cd5fb109fe07f85a4299ff5a77a Mon Sep 17 00:00:00 2001 -From: Inada Naoki -Date: Mon, 29 Jun 2020 10:56:38 +0900 -Subject: [PATCH 1/3] Use PyUnicode_AsUTF8String - -PyUnicode_EncodeUTF8 is deprecated, and PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(p), ...) is inefficient. ---- - src/cnxninfo.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/cnxninfo.cpp b/src/cnxninfo.cpp -index 9934feec..99ce33bd 100644 ---- a/src/cnxninfo.cpp -+++ b/src/cnxninfo.cpp -@@ -42,7 +42,7 @@ bool CnxnInfo_init() - static PyObject* GetHash(PyObject* p) - { - #if PY_MAJOR_VERSION >= 3 -- Object bytes(PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(p), PyUnicode_GET_SIZE(p), 0)); -+ Object bytes(PyUnicode_AsUTF8String(p)); - if (!bytes) - return 0; - p = bytes.Get(); - -From 09864fb7a39ed81d6d0c360ffd796e858e1197d5 Mon Sep 17 00:00:00 2001 -From: Inada Naoki -Date: Sun, 5 Jul 2020 16:06:48 +0900 -Subject: [PATCH 2/3] Fix ExecuteMulti too - ---- - src/params.cpp | 24 +++++++++++++++++++++--- - 1 file changed, 21 insertions(+), 3 deletions(-) - -diff --git a/src/params.cpp b/src/params.cpp -index 20548c2d..108ba02f 100644 ---- a/src/params.cpp -+++ b/src/params.cpp -@@ -1921,9 +1921,10 @@ bool ExecuteMulti(Cursor* cur, PyObject* pSql, PyObject* paramArrayObj) - if (PyUnicode_Check(objCell)) - { - const TextEnc& enc = cur->cnxn->sqlwchar_enc; -- int cb = PyUnicode_GET_DATA_SIZE(objCell) / 2; -- - PyObject* bytes = NULL; -+ -+#if PY_MAJOR_VERSION < 3 -+ int cb = PyUnicode_GET_DATA_SIZE(objCell) / 2; - const Py_UNICODE* source = PyUnicode_AS_UNICODE(objCell); - - switch (enc.optenc) -@@ -1941,11 +1942,28 @@ bool ExecuteMulti(Cursor* cur, PyObject* pSql, PyObject* paramArrayObj) - bytes = PyUnicode_EncodeUTF16(source, cb, "strict", BYTEORDER_BE); - break; - } -- -+#else -+ switch (enc.optenc) -+ { -+ case OPTENC_UTF8: -+ bytes = PyUnicode_AsUTF8String(objCell); -+ break; -+ case OPTENC_UTF16: -+ bytes = PyUnicode_AsUTF16String(objCell); -+ break; -+ case OPTENC_UTF16LE: -+ bytes = PyUnicode_AsEncodedString(objCell, "utf_16_le", NULL); -+ break; -+ case OPTENC_UTF16BE: -+ bytes = PyUnicode_AsEncodedString(objCell, "utf_16_be", NULL); -+ break; -+ } -+#endif - if (bytes && PyBytes_Check(bytes)) - { - objCell = bytes; - } -+ //TODO: Raise or clear error when bytes == NULL. - } - - szLastFunction = "SQLPutData"; - -From 8b0aaf0d8c001c1baad229259805f7d5a85b4aad Mon Sep 17 00:00:00 2001 -From: Keith Erskine -Date: Sat, 5 Feb 2022 19:18:24 -0600 -Subject: [PATCH 3/3] benign commit to trigger build tests - ---- - src/errors.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/errors.h b/src/errors.h -index 771c2696..6ce8d79d 100644 ---- a/src/errors.h -+++ b/src/errors.h -@@ -61,7 +61,7 @@ inline PyObject* RaiseErrorFromException(PyObject* pError) - #if PY_MAJOR_VERSION >= 3 - PyErr_SetObject((PyObject*)Py_TYPE(pError), pError); - #else -- PyObject* cls = (PyObject*)((PyInstance_Check(pError) ? (PyObject*)((PyInstanceObject*)pError)->in_class : (PyObject*)(Py_TYPE(pError)))); -+ PyObject* cls = (PyObject*)((PyInstance_Check(pError) ? (PyObject*)((PyInstanceObject*)pError)->in_class : (PyObject*)(Py_TYPE(pError)))); - PyErr_SetObject(cls, pError); - #endif - return 0; diff --git a/pyodbc.spec b/pyodbc.spec index 2429dbe..1824311 100644 --- a/pyodbc.spec +++ b/pyodbc.spec @@ -1,6 +1,6 @@ Name: pyodbc -Version: 4.0.30 -Release: 10%{?dist} +Version: 4.0.39 +Release: 1%{?dist} Summary: Python DB API 2.0 Module for ODBC License: MIT URL: https://github.com/mkleehammer/pyodbc @@ -10,8 +10,6 @@ BuildRequires: unixODBC-devel BuildRequires: python3-devel BuildRequires: python3-setuptools -Patch0: pyodbc-4.0.30-PyUnicode_AsUTF8String.patch - Recommends: (postgresql-odbc if postgresql-server) Recommends: (mariadb-connector-odbc if mariadb-server) @@ -44,19 +42,28 @@ echo 'Version: %{version}' > PKG-INFO # (If the logic and/or parser in setup.py is changed, this might not work, # but the exact .egg-info filename in %%files works as a regression test.) +%generate_buildrequires +%pyproject_buildrequires + %build -%py3_build +%pyproject_wheel %install -%py3_install +%pyproject_install %files -n python3-%{name} %license LICENSE.txt %doc README.md notes.txt -%{python3_sitearch}/%{name}-%{version}-py%{python3_version}.egg-info/ %{python3_sitearch}/%{name}%{python3_ext_suffix} +%{python3_sitearch}/%{name}-%{version}.dist-info/ +%{python3_sitearch}/pyodbc.pyi %changelog +* Mon Apr 17 2023 Ondřej Sloup - 4.0.39-1 +- Rebase to the newest version +- Remove the PyUnicode_AsUTF8String Patch file, as it is already merged in upstream +- Change packaged files to match new setup.py requirements + * Wed Jan 25 2023 Miro Hrončok - 4.0.30-10 - Fix version in the Python package metadata - This makes the package provide python3dist(pyodbc) = 4.0.30 instead of python3dist(pyodbc) = 4.0.0-unsupported diff --git a/sources b/sources index 732d4e9..356fda5 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (pyodbc-4.0.30.tar.gz) = 022f7f06f4c8e9e15813778e242e1bf130412660805df21c7c90bf94c8af574767c3621ada38d202149c7f01d6ecb6336ef08aa925926620dd1a23341608e9f7 +SHA512 (pyodbc-4.0.39.tar.gz) = 1f54eedc44acc32844cac22b1689d18c9ef789c1ff8da33eed5063937471a13dd28666f4b96081089b244e379d07bc60a8c5f59a275c440e1556f0206c037b47