#
# spec file for package python-MySQL-python
#
# Copyright (c) 2015 SUSE LINUX 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-python
Version:        1.2.5
Release:        10.4
Summary:        Python interface to MySQL
License:        GPL-2.0+
Group:          Development/Languages/Python
Url:            https://github.com/farcepest/MySQLdb1
Source:         https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-%{version}.zip
Patch0:         MySQL-python-Py_ssize.patch

# https://github.com/PyMySQL/mysqlclient-python/pull/177/commits/d663649f851794dffa84010db6290e693d4baab8
Patch100:	MySQL-python-reconnect.patch


BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
#BuildRequires:  mysql-devel
#BuildRequires:  libmysqlclient-devel
BuildRequires:  libmariadb-devel
BuildRequires:  unzip
# Documentation requirements:
BuildRequires:  python2-Sphinx
%if 0%{?suse_version}
Recommends:     mariadb
%endif
Provides:       python-mysql = %{version}
Obsoletes:      python-mysql < %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitearch: %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%endif

%description
MySQLdb is an interface to the popular MySQL database server for
Python.  The design goals are:

- Compliance with Python database API version 2.0 [PEP-0249]
- Thread-safety
- Thread-friendliness (threads will not block each other)

MySQL-3.23 through 5.5 and Python-2.4 through 2.7 are currently
supported. Python-3.0 will be supported in a future release.
PyPy is supported.

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

%patch100 -p1

%build
python setup.py build
python setup.py build_sphinx && rm build/sphinx/html/.buildinfo

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}

%files
%defattr(-,root,root,-)
%doc GPL-2.0 HISTORY README.md build/sphinx/html
%{python_sitearch}/MySQL_python-%{version}-py%{py_ver}.egg-info
%{python_sitearch}/MySQLdb
%{python_sitearch}/_mysql*

%changelog
* Fri Jul 24 2015 seife+obs@b1-systems.com
- Fix build on non-SUSE distros by conditionalizing Recommends: tag
* Sun Dec  8 2013 p.drouand@gmail.com
- Update to version 1.2.4
  + No changelog available
- Set correct Group : Development/Languages/Python
- Use download Url as source
- Spec file general clean-up
- Add MySQL-python-1.2.4-dont-use-python-distribute.patch; don't try
  to use unavailable python-distribute
- Remove depreciate AutoReqProv, %%{py_requires} and # norootforbuild tags
- Add unzip requirement to support tarball format
- Add python-Sphinx requirement and generate html documentation
- Remove --record-rpm=INSTALLED_FILES option and add %%{python_sitearch}
  in %%files instead
- Package GPL-2.0, HISTORY and Sphinx documentation
* Mon Sep 20 2010 coolo@novell.com
- fix the previous fix, patch went upstream
* Thu Sep 16 2010 coolo@novell.com
- update to 1.2.3
  - no upstream changelog available
- taking out the reconnect patch as the upstream sources contain
  a very specific comment that this means trouble
* Fri Jan 16 2009 matejcik@suse.cz
- removed usage of deprecated sets module (bnc#462974)
* Thu Dec 13 2007 matejcik@suse.cz
- update to 1.2.2
  - various bugfixes
  - much better support for mysql5
  - python2.5 support (crude, though, let's keep our patch for a while)
  - switch from distutils to setuptools
- added patch supporting reconnect in mysql5
* Fri Oct 20 2006 jmatejek@suse.cz
- update to 1.2.1_p2
  - support for some new features of mysql 4.1 and 5.0
- fixes for 64bit bugs due to PEP353
* Tue Feb 28 2006 jmatejek@suse.cz
- updated to reflect python changes due to #149809
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Feb  9 2005 mcihar@suse.cz
- update to 1.2.0
* Fri Jan 28 2005 mcihar@suse.cz
- update to 1.1.9 (MySQL 4.1 support)
* Wed Aug  4 2004 mcihar@suse.cz
- updated to 1.1.1
* Wed May 19 2004 mcihar@suse.cz
- fixed lib64 build
* Wed May 19 2004 mcihar@suse.cz
- update to 1.1.0
* Tue Mar  2 2004 mcihar@suse.cz
- drop python 2.1 support
* Sun Jan 11 2004 adrian@suse.de
- build as user
* Tue Dec 16 2003 mcihar@suse.cz
- updated to 0.9.3a2:
  * Add some support for Python 2.3 datetime classes.
  * Removed some casts in _mysql_init() that caused problems with
    Python 2.3. The type for tp_free was changed from destructor
    to freefunc. Removing the casts make both 2.2 and 2.3 happy.
  * Fixed the bug that prevented member access.
  * Embedded server support. Can't get it use InnoDB tables yet.
    However, MyISAM (default) tables seem to work fine.
- one source package for both python versions
- added few more files to docs
* Mon Aug 11 2003 mcihar@suse.cz
- builds on lib64
* Thu Aug  7 2003 mcihar@suse.cz
- updated to 0.9.2
* Mon Jun 16 2003 mcihar@suse.cz
- use record-rpm
* Mon May 12 2003 mcihar@suse.cz
- use versioned dependency on python
* Wed Jan 22 2003 mcihar@suse.cz
- using build root
- file list is correct on lib64 arches
* Tue Jan 15 2002 ro@suse.de
- up to 0.9.1 to make it build on python-2.2
* Sat Dec 29 2001 schwab@suse.de
- Add mysql-shared to neededforbuild.
* Thu Nov  1 2001 vinil@suse.cz
- initial version 0.9.0