]> git.pld-linux.org Git - packages/python-mysql-connector.git/commitdiff
- rel 2; don't return fields as binary incorrectly - https://bugs.mysql.com/bug.php... auto/th/python-mysql-connector-8.0.11-2
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Mon, 28 May 2018 06:56:22 +0000 (08:56 +0200)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Mon, 28 May 2018 06:56:22 +0000 (08:56 +0200)
binary-bug-90585.patch [new file with mode: 0644]
python-mysql-connector.spec
tests.patch [new file with mode: 0644]

diff --git a/binary-bug-90585.patch b/binary-bug-90585.patch
new file mode 100644 (file)
index 0000000..f6b6ca8
--- /dev/null
@@ -0,0 +1,20 @@
+--- mysql-connector-python-8.0.11/src/mysql_capi_conversion.c~ 2018-04-10 14:35:30.000000000 +0200
++++ mysql-connector-python-8.0.11/src/mysql_capi_conversion.c  2018-05-28 08:13:02.693638891 +0200
+@@ -734,7 +734,7 @@ pytomy_decimal(PyObject *obj)
+   @param    use_unicode return Unicode
+   @return   Converted string
+-    @retval PyUnicode   if not BINARY_FLAG
++    @retval PyUnicode   if not binary charset
+     @retval PyBytes     Python v3 if not use_unicode
+     @retval PyString    Python v2 if not use_unicode
+     @retval NULL    Exception
+@@ -756,7 +756,7 @@ mytopy_string(const char *data, const un
+         return NULL;
+     }
+-    if (!(flags & BINARY_FLAG) && use_unicode && strcmp(charset, "binary") != 0)
++    if (use_unicode && strcmp(charset, "binary") != 0)
+     {
+         return PyUnicode_Decode(data, length, charset, NULL);
+     }
index e5a83b0271c101c14bc3f1945f9cb6a84d881720..3f3e8809773df0419fa4a24ad35c19f55f516182 100644 (file)
@@ -2,7 +2,8 @@
 # - c extension build is done in install phase (http://bugs.mysql.com/bug.php?id=78621)
 #
 # Conditional build:
-%bcond_with            tests           # build with tests (requires mysql server)
+%bcond_with    tests           # build with tests (requires mysql server)
+%bcond_without python2         # build without python2
 %bcond_without python3         # build without python3
 
 %define                pname   mysql-connector
@@ -11,20 +12,30 @@ Name:               python-%{pname}
 # check documentation to see which version is GA (we don't want devel releases)
 # https://dev.mysql.com/downloads/connector/python/
 Version:       8.0.11
-Release:       1
+Release:       2
 License:       GPL v2
 Group:         Libraries/Python
 Source0:       http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-%{version}.zip
 # Source0-md5: d47704b39d794b287d146c3d772ab896
 Patch0:                32bit.patch
+Patch1:                binary-bug-90585.patch
+Patch2:                tests.patch
 URL:           http://dev.mysql.com/doc/connector-python/en/
 BuildRequires: mysql-devel
 BuildRequires: protobuf-devel
+%if %{with python2}
 BuildRequires: python-devel
 BuildRequires: python-modules
-%{?with_python3:BuildRequires: python3-modules}
+%endif
+%if %{with python3}
+BuildRequires: python3-devel
+BuildRequires: python3-modules
+%endif
 BuildRequires: rpm-pythonprov
 BuildRequires: rpmbuild(macros) >= 1.710
+%if %{with tests}
+BuildRequires: mysql
+%endif
 Requires:      python-modules
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -48,18 +59,38 @@ driver. An interface to the popular MySQL database server for Python.
 %prep
 %setup -q -n mysql-connector-python-%{version}
 %patch0 -p1
+%patch1 -p1
+%patch2 -p1
 
 %build
 export MYSQLXPB_PROTOC=%{_bindir}/protoc
 export MYSQLXPB_PROTOBUF_INCLUDE_DIR=%{_includedir}
 export MYSQLXPB_PROTOBUF_LIB_DIR=%{_libdir}
 
+%if %{with python2}
 %py_build
-%{?with_tests:%{__python} setup.py test}
+%if %{with tests}
+export PYTHONPATH="$(pwd)/$(ls -1d build-2/lib*)"
+%{__python} unittests.py \
+       --verbosity 1 \
+       --keep --stats \
+       --skip-install \
+       --with-mysql=%{_prefix} \
+       --with-mysql-share=%{_datadir}/mysql
+%endif
+%endif
 
 %if %{with python3}
 %py3_build
-%{?with_tests:%{__python3} setup.py test}
+%if %{with tests}
+export PYTHONPATH="$(pwd)/$(ls -1d build-3/lib*)"
+%{__python3} unittests.py \
+       --verbosity 1 \
+       --keep --stats \
+       --skip-install \
+       --with-mysql=%{_prefix} \
+       --with-mysql-share=%{_datadir}/mysql
+%endif
 %endif
 
 %install
@@ -70,9 +101,11 @@ export MYSQLXPB_PROTOC=%{_bindir}/protoc
 export MYSQLXPB_PROTOBUF_INCLUDE_DIR=%{_includedir}
 export MYSQLXPB_PROTOBUF_LIB_DIR=%{_libdir}
 
+%if %{with python2}
 %py_install \
        --with-mysql-capi=%{_prefix}
 %py_postclean
+%endif
 
 %if %{with python3}
 %py3_install \
@@ -82,6 +115,7 @@ export MYSQLXPB_PROTOBUF_LIB_DIR=%{_libdir}
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%if %{with python2}
 %files
 %defattr(644,root,root,755)
 %doc CHANGES.txt README.txt
@@ -109,6 +143,7 @@ rm -rf $RPM_BUILD_ROOT
 %if "%{py_ver}" > "2.4"
 %{py_sitedir}/mysql_connector_python-*.egg-info
 %endif
+%endif
 
 %if %{with python3}
 %files -n python3-%{pname}
diff --git a/tests.patch b/tests.patch
new file mode 100644 (file)
index 0000000..5023b99
--- /dev/null
@@ -0,0 +1,28 @@
+--- mysql-connector-python-8.0.11/tests/mysqld.py~     2018-04-10 14:35:30.000000000 +0200
++++ mysql-connector-python-8.0.11/tests/mysqld.py      2018-05-28 08:25:18.652587431 +0200
+@@ -185,24 +185,7 @@ class MySQLServerBase(object):
+         """
+         # Locate mysqld, mysql binaries
+-        LOGGER.info("Locating mysql binaries (could take a while)")
+-        files_to_find = [EXEC_MYSQL, EXEC_MYSQLD]
+-        for root, dirs, files in os.walk(self._basedir):
+-            if self._sbindir:
+-                break
+-            for afile in files:
+-                if (afile == EXEC_MYSQLD and
+-                        os.access(os.path.join(root, afile), 0)):
+-                    self._sbindir = root
+-                    files_to_find.remove(EXEC_MYSQLD)
+-                elif (afile == EXEC_MYSQL and
+-                        os.access(os.path.join(root, afile), 0)):
+-                    self._bindir = root
+-                    files_to_find.remove(EXEC_MYSQL)
+-
+-                if not files_to_find:
+-                    break
+-
++        self._sbindir = '/usr/sbin'
+         if not self._sbindir:
+             raise MySQLBootstrapError(
This page took 0.135496 seconds and 4 git commands to generate.