%if 0%{?rhel} && 0%{?rhel} <= 6 %{!?__python2: %global __python2 /usr/bin/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))")} %endif # python3-flask is only packaged for f20 and newer, so there's no point in # building for python3 in earlier relases %if (0%{?fedora} > 19) %global with_python3 1 %endif %global pkgname python-flask-restful %global tarball_name Flask-RESTful Name: python-flask-restful Version: 0.2.11 Release: 1%{?dist} Summary: Simple framework for creating REST APIs Group: Development/Languages License: BSD URL: https://www.github.com/twilio/flask-restful/ Source0: https://pypi.python.org/packages/source/F/Flask-RESTful/%{tarball_name}-%{version}.tar.gz Patch0: test_types_py3k_compatibility.patch BuildArch: noarch Requires: python-flask Requires: python-six Requires: python-aniso8601 Requires: pytz BuildRequires: python-flask BuildRequires: python-six BuildRequires: python-aniso8601 BuildRequires: pytz BuildRequires: python2-devel python-setuptools BuildRequires: python-nose BuildRequires: python-mock BuildRequires: python-blinker BuildRequires: python-crypto %description Flask-RESTful is Python 2 extension for Flask that adds support for quickly building REST APIs. It is a lightweight abstraction that works with your existing ORM/libraries. %if 0%{?with_python3} %package -n python3-flask-restful Summary: %{summary} Requires: python3-flask Requires: python3-six Requires: python3-aniso8601 Requires: python3-pytz BuildRequires: python3-flask BuildRequires: python3-six BuildRequires: python3-aniso8601 BuildRequires: python3-pytz BuildRequires: python3-devel python3-setuptools BuildRequires: python3-nose BuildRequires: python3-mock BuildRequires: python3-blinker BuildRequires: python3-crypto %description -n python3-flask-restful Flask-RESTful is Python 3 extension for Flask that adds support for quickly building REST APIs. It is a lightweight abstraction that works with your existing ORM/libraries. %endif %prep %setup -qn %{tarball_name}-%{version} %patch0 -p1 %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' %endif %build %{__python2} setup.py build %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py build popd %endif %install %{__python2} setup.py install --skip-build --root %{buildroot} %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install --skip-build --root %{buildroot} popd %endif %check %{__python2} setup.py nosetests %if 0%{?with_python3} %{__python3} setup.py nosetests %endif %files %{python2_sitelib}/* %exclude %{python2_sitelib}/tests %if 0%{?with_python3} %files -n python3-flask-restful %{python3_sitelib}/* %exclude %{python3_sitelib}/tests %endif %changelog * Wed Jan 22 2014 Jan Sedlak - 0.2.11-1 - initial packaging