File python-mysql.spec of Package python-mysql

#
# spec file for package python-mysql
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           python-mysql
Version:        1.2.4
Release:        0
Summary:        An Interface to the Popular MySQL Database Server for Python
License:        GPL-2.0+
Group:          Development/Languages/Python
Url:            http://sourceforge.net/projects/mysql-python
Source0:        https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-%{version}.zip
Patch0:         MySQL-python-1.2.4-ssize.patch
# PATCH-FIX-UPSTREAM MySQL-python-1.2.4-dont-use-python-distribute.patch --setup script wan't import setuptools
# from distribute at first and try to download it
Patch1:         MySQL-python-1.2.4-dont-use-python-distribute.patch
BuildRequires:  python-Sphinx
BuildRequires:  mysql-devel
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRequires:  unzip
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
MySQLdb is an interface to the popular MySQL database server for
Python. The design goals are:
-     Compliance with the Python database API version 2.0
-     Thread-safety
-     Thread-friendliness (threads will not block each other)
-     Compatibility with MySQL-3.23 and later

This module should be mostly compatible with an older interface written
by Joe Skinner and others. However, the older version is a) not
thread-friendly, b) written for MySQL 3.21, and c) apparently not
actively maintained. No code from that version is used in MySQLdb.
MySQLdb is free software.

%prep
%setup -n MySQL-python-%{version}
# Fix wrong-file-end-of-line-encoding rpmlint warning
sed -i 's/\r$//' HISTORY
sed -i 's/\r$//' README.md
%patch0
%patch1 -p1

%build
export CFLAGS="$RPM_OPT_FLAGS" 
export mysqlversion="$(mysql_config --version)"
export mysqlclient="mysqlclient_r"
python setup.py build
python setup.py build_sphinx

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
# Remove hidden file generated by Sphinx
rm build/sphinx/html/.buildinfo
sed -i 's/\r$//' build/sphinx/html/_sources/*.txt

%files
%defattr(-, root, root)
%doc GPL-2.0 HISTORY README.md build/sphinx/html
%{python_sitearch}

%changelog
openSUSE Build Service is sponsored by