%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.26.13 Release: 2%{?dist} Summary: Various utility functions for SQLAlchemy Group: Development/Libraries 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: python-setuptools BuildRequires: python-six BuildRequires: python-sqlalchemy >= 0.9.3 Requires: python-sqlalchemy >= 0.9.3 Requires: python-six %if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-six BuildRequires: python3-sqlalchemy >= 0.9.3 Requires: python3-sqlalchemy >= 0.9.3 Requires: python3-six %endif # if with_python3 %description Various utility functions and custom data types for SQLAlchemy. %if 0%{?with_python3} %package -n python3-sqlalchemy-utils Summary: Various utility functions for SQLAlchemy %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} %{__python3} setup.py test popd %endif # with_python3 %{__python2} setup.py test %files %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 * Mon Sep 01 2014 Pierre-Yves Chibon - 0.26.13-2 - Clean python macro at the top - Add python3 subpackage * Tue Aug 26 2014 Pierre-Yves Chibon - 0.26.13-1 - initial package for Fedora