# sitelib for noarch packages, sitearch for others (remove the unneeded one) %{!?__python2: %global __python2 %__python} %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} # We are manually generating debug packages %define debug_package %{nil} %if 0%{?fedora} %bcond_without python3 %else %bcond_with python3 %endif Name: python-pymssql Version: 2.1.1 Release: 1%{?dist} Summary: A Microsoft SQL Server database adapter for Python License: LGPLv2+ URL: http://pymssql.org Source0: https://github.com/pymssql/pymssql/archive/v%{version}.tar.gz#/pymssql-%{version}.tar.gz # Newer versions of Cython are more picky Patch0: https://patch-diff.githubusercontent.com/raw/pymssql/pymssql/pull/311.diff # setuptools-git is not actually required to build the project Patch1: no-setuptools-git.patch Patch2: correct-cython-version.patch BuildRequires: freetds-devel BuildRequires: Cython BuildRequires: python2-devel BuildRequires: python-debug BuildRequires: python-setuptools %if %{with python3} BuildRequires: python3-Cython BuildRequires: python3-devel BuildRequires: python3-debug BuildRequires: python3-setuptools %endif # with python3 Requires: freetds %description A simple database interface for Python that builds on top of FreeTDS to provide a Python DB-API (PEP-249) interface to Microsoft SQL Server. %package debug Summary: A Microsoft SQL Server database adapter for Python 2 (debug build) Requires: %{name} = %{version}-%{release} %description debug This is a build of the pymssql Microsoft SQL Server database adapter for the debug build of Python 2 %if %{with python3} %package -n python3-pymssql Summary: A Microsoft SQL Server database adapter for Python %description -n python3-pymssql A simple database interface for Python that builds on top of FreeTDS to provide a Python DB-API (PEP-249) interface to Microsoft SQL Server. %package -n python3-pymssql-debug Summary: A Microsoft SQL Server database adapter for Python 3 (debug build) Requires: python3-pymssql = %{version}-%{release} %description -n python3-pymssql-debug This is a build of the pymssql Microsoft SQL Server database adapter for the debug build of Python 3. %endif # with python3 %prep %setup -qc pushd pymssql-%{version} %patch0 -p 1 %patch1 -p 1 %patch2 -p 1 popd mv pymssql-%{version} python2 %if %{with python3} cp -a python2 python3 %endif # with python3 %build pushd python2 # Remove CFLAGS=... for noarch packages (unneeded) PYMSSQL_DONT_BUILD_WITH_BUNDLED_FREETDS=YES CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build PYMSSQL_DONT_BUILD_WITH_BUNDLED_FREETDS=YES CFLAGS="$RPM_OPT_FLAGS" %{__python2}-debug setup.py build popd %if %{with python3} pushd python3 # Remove CFLAGS=... for noarch packages (unneeded) PYMSSQL_DONT_BUILD_WITH_BUNDLED_FREETDS=YES CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build PYMSSQL_DONT_BUILD_WITH_BUNDLED_FREETDS=YES CFLAGS="$RPM_OPT_FLAGS" %{__python3}-debug setup.py build popd %endif # with python3 %install # Must do the python3 install first because the scripts in /usr/bin are # overwritten with every setup.py install (and we want the python2 version # to be the default for now). %if %{with python3} pushd python3 %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT %{__python3}-debug setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT chmod 0644 $RPM_BUILD_ROOT/%{python3_sitearch}/*.so popd %endif # with python3 pushd python2 %{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT %{__python2}-debug setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT chmod 0644 $RPM_BUILD_ROOT%{python2_sitearch}/*.so popd %files %license python2/LICENSE %{python2_sitearch}/pymssql.so %{python2_sitearch}/_mssql.so %{python2_sitearch}/*.egg-info/* %files debug %license python2/LICENSE %{python2_sitearch}/pymssql_d.so %{python2_sitearch}/_mssql_d.so %if %{with python3} %files -n python3-pymssql %license python3/LICENSE %{python3_sitearch}/pymssql.cpython-3?m*.so %{python3_sitearch}/_mssql.cpython-3?m*.so %{python3_sitearch}/*.egg-info/* %files -n python3-pymssql-debug %license python3/LICENSE %{python3_sitearch}/pymssql.cpython-3?dm*.so %{python3_sitearch}/_mssql.cpython-3?dm*.so %endif # with python3 %changelog * Thu Jan 28 2016 Stefan Nuxoll 2.1.1-1 - Version 2.1.1