Files
rpms/fedora/SPECS/archive/python-mysql.spec

177 lines
4.9 KiB
RPMSpec
Raw Normal View History

%bcond_without debug
%define pkgname mysqlclient-python
# share doc between python2 and python3
%global _docdir_fmt %{name}
Summary: An interface to MySQL
Name: python-mysql
Version: 1.4.2.post1
Release: 1%{?dist}
License: GPLv2+
Group: Development/Libraries
URL: https://github.com/PyMySQL/mysqlclient-python
Source0: %{pkgname}-%{version}.tar.gz
BuildRequires: gcc
BuildRequires: python2-devel python2-setuptools
BuildRequires: python3-devel python3-setuptools
BuildRequires: mariadb-connector-c-devel openssl-devel zlib-devel
%if %{with debug}
BuildRequires: python2-debug python3-debug
%endif
%description
Python interface to MySQL
MySQLdb is an interface to the popular MySQL database server for Python.
The design goals are:
- Compliance with Python database API version 2.0
- Thread-safety
- Thread-friendliness (threads will not block each other)
%package -n python2-mysql
Summary: An interface to MySQL
Group: Development/Libraries
Provides: MySQL-python = %{version}-%{release}
Obsoletes: MySQL-python < 1.3.6-4
Provides: python-mysql = %{version}-%{release}
Obsoletes: python-mysql < 1.3.7-2
%description -n python2-mysql
Python2 interface to MySQL
MySQLdb is an interface to the popular MySQL database server for Python2.
The design goals are:
- Compliance with Python database API version 2.0
- Thread-safety
- Thread-friendliness (threads will not block each other)
%if %{with debug}
%package -n python2-mysql-debug
Summary: An interface to MySQL, built for the CPython debug runtime
Group: Applications/System
# Require the base package for the .py/.pyc files:
Requires: python2-mysql%{_isa} = %{version}-%{release}
Provides: MySQL-python-debug = %{version}-%{release}
Obsoletes: MySQL-python-debug < 1.3.6-4
Provides: python-mysql-debug = %{version}-%{release}
Obsoletes: python-mysql-debug < 1.3.7-2
%description -n python2-mysql-debug
Python interface to MySQL, built for the CPython debug runtime
%endif # with debug
%package -n python3-mysql
Summary: An interface to MySQL
Group: Development/Libraries
Provides: MySQL-python3 = %{version}-%{release}
Obsoletes: MySQL-python3 < 1.3.6-4
%description -n python3-mysql
Python3 interface to MySQL
MySQLdb is an interface to the popular MySQL database server for Python3.
The design goals are:
- Compliance with Python database API version 2.0
- Thread-safety
- Thread-friendliness (threads will not block each other)
%if %{with debug}
%package -n python3-mysql-debug
Summary: An interface to MySQL, built for the CPython debug runtime
Group: Applications/System
# Require the base package for the .py/.pyc files:
Requires: python3-mysql%{_isa} = %{version}-%{release}
Provides: MySQL-python3-debug = %{version}-%{release}
Obsoletes: MySQL-python3-debug < 1.3.6-4
%description -n python3-mysql-debug
Python3 interface to MySQL, built for the CPython debug runtime
%endif # with debug
%prep
%autosetup -n %{pkgname}-%{version} -p1
%build
%py2_build
%if %{with debug}
CFLAGS="$RPM_OPT_FLAGS" %{__python2}-debug setup.py build
%endif
%py3_build
%if %{with debug}
CFLAGS="$RPM_OPT_FLAGS" %{__python3}-debug setup.py build
%endif
%install
%py2_install
%if %{with debug}
%{__python2}-debug setup.py install -O1 --skip-build --root %{buildroot}
%endif
%py3_install
%if %{with debug}
%{__python3}-debug setup.py install -O1 --skip-build --root %{buildroot}
%endif
%check
# You need MySQL (or MariaDB) running
# and ~/.my.conf configured to have access rights
#
# cd tests/
# python -m unittest test_MySQLdb_capabilities
# python -m unittest test_MySQLdb_dbapi20
# python -m unittest test_MySQLdb_nonstandard
%files -n python2-mysql
%doc README.md doc/*
%license LICENSE
%dir %{python2_sitearch}/MySQLdb
%{python2_sitearch}/MySQLdb/*.py
%{python2_sitearch}/MySQLdb/*.py[co]
%{python2_sitearch}/MySQLdb/*.so
%dir %{python2_sitearch}/MySQLdb/constants
%{python2_sitearch}/MySQLdb/constants/*.py
%{python2_sitearch}/MySQLdb/constants/*.py[co]
%{python2_sitearch}/mysqlclient-%{version}-py2.*.egg-info
%if %{with debug}
%files -n python2-mysql-debug
%{python2_sitearch}/MySQLdb/_mysql_d.so
#%{python2_sitearch}/MySQLdb/_mysql.so*.debug
%endif
%files -n python3-mysql
%doc README.md doc/*
%license LICENSE
%dir %{python3_sitearch}/MySQLdb
%{python3_sitearch}/MySQLdb/*.py
%dir %{python3_sitearch}/MySQLdb/__pycache__
%{python3_sitearch}/MySQLdb/__pycache__/*.py[co]
%{python3_sitearch}/MySQLdb/*.so
%dir %{python3_sitearch}/MySQLdb/constants
%{python3_sitearch}/MySQLdb/constants/*.py
%dir %{python3_sitearch}/MySQLdb/constants/__pycache__
%{python3_sitearch}/MySQLdb/constants/__pycache__/*.py[co]
%{python3_sitearch}/mysqlclient-%{version}-py3.*.egg-info
%if %{with debug}
%files -n python3-mysql-debug
%{python3_sitearch}/MySQLdb/_mysql.cpython-3?dm*.so
#%{python3_sitearch}/MySQLdb/_mysql.cpython-37m-x86_64-linux-gnu.so*.debug
%endif # with debug
%changelog
2020-09-04 09:08:36 +02:00
* Sun Apr 28 2019 Daniel Steiner <daniel.steiner@dsteiner.ch>
- Initial relase for fedora 29 (1.4.2).