2013-07-22 10:11:40 +02:00
|
|
|
#
|
|
|
|
# spec file for package python-PyMySQL
|
|
|
|
#
|
2020-06-05 12:18:24 +02:00
|
|
|
# Copyright (c) 2020 SUSE LLC
|
2013-07-22 10:11:40 +02:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
2019-03-06 10:16:57 +01:00
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
2013-10-09 15:30:14 +02:00
|
|
|
#
|
2013-07-22 10:11:40 +02:00
|
|
|
|
|
|
|
|
2017-08-16 04:22:53 +02:00
|
|
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
2013-07-22 10:11:40 +02:00
|
|
|
Name: python-PyMySQL
|
2019-03-06 10:16:57 +01:00
|
|
|
Version: 0.9.3
|
2013-07-22 10:11:40 +02:00
|
|
|
Release: 0
|
|
|
|
Summary: Pure Python MySQL Driver
|
2013-10-09 15:30:14 +02:00
|
|
|
License: MIT
|
2013-07-22 10:11:40 +02:00
|
|
|
Group: Development/Languages/Python
|
2018-05-24 13:15:01 +02:00
|
|
|
URL: https://github.com/PyMySQL/PyMySQL/
|
2020-06-05 12:18:24 +02:00
|
|
|
Source: https://github.com/PyMySQL/PyMySQL/archive/v%{version}.tar.gz#/PyMySQL-0.9.3.tar.gz
|
|
|
|
# https://github.com/PyMySQL/PyMySQL/commit/a500fcd64d4500417540a2a2ff7b16a88d1872ad
|
|
|
|
Patch0: python-PyMySQL-no-unittest2.patch
|
2019-03-06 10:16:57 +01:00
|
|
|
BuildRequires: %{python_module cryptography}
|
|
|
|
BuildRequires: %{python_module pytest}
|
2017-08-16 04:22:53 +02:00
|
|
|
BuildRequires: %{python_module setuptools}
|
2020-06-05 12:18:24 +02:00
|
|
|
BuildRequires: mariadb-rpm-macros
|
2019-03-06 10:16:57 +01:00
|
|
|
# will be removed with next release
|
2017-08-16 04:22:53 +02:00
|
|
|
BuildRequires: fdupes
|
|
|
|
BuildRequires: python-rpm-macros
|
2019-03-06 10:16:57 +01:00
|
|
|
Requires: python-cryptography
|
2013-07-22 10:11:40 +02:00
|
|
|
BuildArch: noarch
|
2017-08-16 04:22:53 +02:00
|
|
|
%python_subpackages
|
2013-07-22 10:11:40 +02:00
|
|
|
|
|
|
|
%description
|
|
|
|
This package contains a pure-Python MySQL client library. Documentation on the
|
|
|
|
MySQL client/server protocol can be found here:
|
2017-08-16 04:22:53 +02:00
|
|
|
http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol
|
|
|
|
|
2013-07-22 10:11:40 +02:00
|
|
|
The goal of pymysql is to be a drop-in replacement for MySQLdb and work on
|
|
|
|
CPython 2.3+, Jython, IronPython, PyPy and Python 3. We test for compatibility
|
|
|
|
by simply changing the import statements in the Django MySQL backend and running
|
|
|
|
its unit tests as well as running it against the MySQLdb and myconnpy unit tests.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q -n PyMySQL-%{version}
|
2020-06-05 12:18:24 +02:00
|
|
|
%patch0 -p1
|
2015-05-12 23:35:14 +02:00
|
|
|
# remove unwanted shebang
|
|
|
|
sed -i '1 { /^#!/ d }' pymysql/tests/thirdparty/test_MySQLdb/*.py
|
2013-07-22 10:11:40 +02:00
|
|
|
|
|
|
|
%build
|
2017-08-16 04:22:53 +02:00
|
|
|
%python_build
|
2013-07-22 10:11:40 +02:00
|
|
|
|
|
|
|
%install
|
2017-08-16 04:22:53 +02:00
|
|
|
%python_install
|
|
|
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
2013-07-22 10:11:40 +02:00
|
|
|
|
2019-03-06 10:16:57 +01:00
|
|
|
%check
|
2020-06-05 12:18:24 +02:00
|
|
|
exit_code=0
|
|
|
|
dbuser='db_user'
|
|
|
|
dbuserpw='db_user_secret'
|
|
|
|
dbname1='test1'
|
|
|
|
dbname2='test2'
|
2019-03-06 10:16:57 +01:00
|
|
|
# Needs mysql server
|
|
|
|
#%%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} py.test-%{$python_bin_suffix} -v
|
2020-06-05 12:18:24 +02:00
|
|
|
cconf=abuild-myclient.cnf
|
|
|
|
#
|
|
|
|
# start the mariadb server
|
|
|
|
#
|
|
|
|
%mysql_testserver_start -u $dbuser -p $dbuserpw -d $dbname1:$dbname2 -t 3306
|
|
|
|
#
|
|
|
|
# creating client config, see base.py
|
|
|
|
#
|
|
|
|
cat << EOF > pymysql/tests/databases.json
|
|
|
|
[{"host":"localhost","user":"$dbuser","passwd":"$dbuserpw",
|
|
|
|
"db":"$dbname1", "use_unicode": true, "local_infile": true},
|
|
|
|
{"host":"localhost","user":"$dbuser","passwd":"$dbuserpw","db":"$dbname2"}]
|
|
|
|
EOF
|
|
|
|
#
|
|
|
|
# running the test
|
|
|
|
#
|
|
|
|
export USER="$dbuser"
|
|
|
|
export PASSWORD="$dbuserpw"
|
|
|
|
%pytest pymysql/tests || exit_code=1
|
|
|
|
#
|
|
|
|
# stopping mariadb
|
|
|
|
#
|
|
|
|
%mysql_testserver_stop
|
|
|
|
exit $exit_code
|
2013-07-22 10:11:40 +02:00
|
|
|
|
2017-08-16 04:22:53 +02:00
|
|
|
%files %{python_files}
|
2018-05-24 13:04:59 +02:00
|
|
|
%license LICENSE
|
2018-05-24 13:15:01 +02:00
|
|
|
%doc CHANGELOG README.rst
|
2013-07-22 10:11:40 +02:00
|
|
|
%{python_sitelib}/*
|
|
|
|
|
|
|
|
%changelog
|