Blob Blame History Raw
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2:        %global __python2 /usr/bin/python2}
%{!?python2_sitelib:  %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%endif

%if 0%{?fedora} > 12
%global with_python3 1
%endif

%global modname SQLAlchemy-Utils

Name:               python-sqlalchemy-utils
Version:            0.32.12
Release:            8%{?dist}
Summary:            Various utility functions for SQLAlchemy

License:            BSD
URL:                http://pypi.python.org/pypi/SQLAlchemy-Utils
Source0:            http://pypi.python.org/packages/source/S/%{modname}/%{modname}-%{version}.tar.gz

BuildArch:          noarch

BuildRequires:      python2-devel
BuildRequires:      python2-setuptools
BuildRequires:      python2-six
BuildRequires:      python2-sqlalchemy >= 0.9.3
BuildRequires:      python2-pytest
BuildRequires:      python2-pytz
BuildRequires:      python2-flexmock
BuildRequires:      python2-dateutil
BuildRequires:      python2-mock


%if 0%{?with_python3}
BuildRequires:      python3-devel
BuildRequires:      python3-setuptools
BuildRequires:      python3-six
BuildRequires:      python3-sqlalchemy >= 0.9.3
BuildRequires:      python3-pytest
BuildRequires:      python3-pytz
BuildRequires:      python3-flexmock
BuildRequires:      python3-dateutil
BuildRequires:      python3-mock
%endif # if with_python3

%global _description\
Various utility functions and custom data types for SQLAlchemy.\


%description %_description

%package -n python2-sqlalchemy-utils
Summary: %summary
Requires:           python2-sqlalchemy >= 0.9.3
Requires:           python2-six
%{?python_provide:%python_provide python2-sqlalchemy-utils}

%description -n python2-sqlalchemy-utils %_description

%if 0%{?with_python3}
%package -n         python3-sqlalchemy-utils
Summary:            Various utility functions for SQLAlchemy
Requires:           python3-sqlalchemy >= 0.9.3
Requires:           python3-six

%description -n python3-sqlalchemy-utils
Various utility functions and custom data types for SQLAlchemy.
%endif # with_python3


%prep
%setup -q -n %{modname}-%{version}

# Remove bundled egg-info in case it exists
rm -rf %{modname}.egg-info

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3
 
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'


%build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3

%{__python2} setup.py build


%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
popd
%endif # with_python3

%{__python2} setup.py install -O1 --skip-build --root=%{buildroot}

%check
%if 0%{?with_python3}
pushd %{py3dir}
# Unit-tests seems to be broken in the unittest module on py3.5
#%{__python3} setup.py test
popd
%endif # with_python3

%{__python2} setup.py test


%files -n python2-sqlalchemy-utils
%doc README.rst LICENSE
%{python2_sitelib}/sqlalchemy_utils
%{python2_sitelib}/SQLAlchemy_Utils-%{version}*

%if 0%{?with_python3}
%files -n python3-sqlalchemy-utils
%doc README.rst LICENSE
%{python3_sitelib}/sqlalchemy_utils
%{python3_sitelib}/SQLAlchemy_Utils-%{version}*
%endif # with_python3


%changelog
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.32.12-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.32.12-7
- Rebuilt for Python 3.7

* Mon Feb 12 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.32.12-6
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.32.12-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Sun Dec 17 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.32.12-4
- Python 2 binary package renamed to python2-sqlalchemy-utils
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.32.12-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.32.12-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Fri Jan 20 2017 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.32.12-1
- Update to 0.32.12

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.31.3-3
- Rebuild for Python 3.6

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.31.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Fri Nov 20 2015 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.31.3-1
- Update to 0.31.3

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.30.0-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.30.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sun Apr 26 2015 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.30.0-1
- Update to 0.30.0

* Mon Sep 01 2014 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.26.13-2
- Clean python macro at the top
- Add python3 subpackage

* Tue Aug 26 2014 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.26.13-1
- initial package for Fedora