%global _with_python3 1
%if 0%{?rhel}
%global py2_prefix python
%else
%global py2_prefix python2
%endif
%global srcname pymssql
%global common_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.
Name: python-%{srcname}
Version: 2.1.4
Release: 1%{?dist}
Summary: DB-API interface to Microsoft SQL Server
Group: System Environment/Libraries
License: LGPLv2+
URL: http://pymssql.org/
Source0: https://github.com/pymssql/pymssql/archive/%{version}/%{srcname}-%{version}.tar.gz
# Allow pymssql to be built with current version of Cython provided in EPEL
Patch0: %{name}-2.1.3-Cython.patch
# Disable dependency on setuptools_git, actually not needed to build the library
Patch1: %{name}-2.1.3-disable_setuptools_git.patch
BuildRequires: gcc
BuildRequires: freetds-devel
BuildRequires: %{py2_prefix}-devel
BuildRequires: %{py2_prefix}-setuptools
%if 0%{?rhel}
BuildRequires: Cython
%else
BuildRequires: %{py2_prefix}-Cython
%endif
%if 0%{?_with_python3}
BuildRequires: python%{python3_pkgversion}-Cython
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
%endif
%description
%{common_description}
%package -n python2-%{srcname}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{srcname}}
%description -n python2-%{srcname}
%{common_description}
%if 0%{?_with_python3}
%package -n python%{python3_pkgversion}-%{srcname}
Summary: %{summary}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
%description -n python%{python3_pkgversion}-%{srcname}
%{common_description}
%endif
%prep
%autosetup -n %{srcname}-%{version}
# Delete bundled FreeTDS static library
rm -r freetds0.95/
%build
export PYMSSQL_DONT_BUILD_WITH_BUNDLED_FREETDS=1
%py2_build
%{?_with_python3:%py3_build}
%install
%py2_install
%{?_with_python3:%py3_install}
# No %%check (unit tests require a running SQL Server database)
%files -n python2-%{srcname}
%doc ChangeLog README.rst
%license LICENSE
%{python2_sitearch}/*
%if 0%{?_with_python3}
%files -n python%{python3_pkgversion}-%{srcname}
%doc ChangeLog README.rst
%license LICENSE
%{python3_sitearch}/*
%endif
%changelog
* Tue Apr 09 2019 Mohamed El Morabity <melmorabity@fedoraproject.org> - 2.1.4-1
- Update to 2.1.4
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 19 2018 Miro HronĨok <mhroncok@redhat.com> - 2.1.3-4
- Rebuilt for Python 3.7
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Aug 10 2017 Mohamed El Morabity <melmorabity@fedoraproject.org> - 2.1.3-2
- Use python2- prefix for Fedora dependencies
* Sun Jul 2 2017 Mohamed El Morabity <melmorabity@fedoraproject.org> - 2.1.3-1
- Initial RPM release