From d389d8e4402a201f89f677e46895107a37ab16f8 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 20 Mar 2011 11:10:06 +0100 Subject: make python3 conditional --- mysql-connector-python.spec | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/mysql-connector-python.spec b/mysql-connector-python.spec index a5d9d4a..40ada50 100644 --- a/mysql-connector-python.spec +++ b/mysql-connector-python.spec @@ -1,5 +1,11 @@ %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%if 0%{?fedora} >= 13 +%global with_python3 1 +%else +%global with_python3 0 +%endif + Name: mysql-connector-python Version: 0.3.2 Release: 2%{?dist} @@ -13,7 +19,9 @@ Source0: http://launchpad.net/myconnpy/0.3/%{version}/+download/%{name}-% BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: python-devel +%if 0%{?with_python3} BuildRequires: python3-devel +%endif # for unittest BuildRequires: mysql-server @@ -23,6 +31,7 @@ MySQL Connector/Python is implementing the MySQL Client/Server protocol completely in Python. No MySQL libraries are needed, and no compilation is necessary to run this Python DB API v2.0 compliant driver. +%if 0%{?with_python3} %package -n mysql-connector-python3 Summary: MySQL Connector for Python 3 @@ -31,6 +40,7 @@ Summary: MySQL Connector for Python 3 MySQL Connector/Python is implementing the MySQL Client/Server protocol completely in Python. No MySQL libraries are needed, and no compilation is necessary to run this Python DB API v2.0 compliant driver. +%endif %prep @@ -45,10 +55,13 @@ is necessary to run this Python DB API v2.0 compliant driver. %install %{__rm} -rf $RPM_BUILD_ROOT + +%if 0%{?with_python3} # Python 3 build %{__python3} setup.py install --root $RPM_BUILD_ROOT - %{__rm} -rf build +%endif + # Python 2 build (end with this for tests) %{__python} setup.py install --root $RPM_BUILD_ROOT @@ -68,12 +81,13 @@ is necessary to run this Python DB API v2.0 compliant driver. %{python_sitelib}/* +%if 0%{?with_python3} %files -n mysql-connector-python3 %defattr(-,root,root,-) %doc ChangeLog COPYING EXCEPTIONS-CLIENT README %doc python3/examples %{python3_sitelib}/* - +%endif %changelog * Sun Mar 20 2011 Remi Collet 0.3.2-2 -- cgit