%if 0%{?fedora} > 12 %global with_python3 1 %else %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %endif %global upstream_name requests Name: python-%{upstream_name} Version: 2.3.0 Release: 1%{?dist} Summary: HTTP library, written in Python, for human beings. Group: Development/Libraries License: ASL 2.0 URL: http://python-requests.org Source0: https://pypi.python.org/packages/source/r/requests/requests-2.3.0.tar.gz BuildRequires: python-devel python-setuptools %if 0%{?with_python3} BuildRequires: python3-devel python3-setuptools # For /usr/bin/2to3 BuildRequires: python-tools %endif # if with_python3 %description Most existing Python modules for sending HTTP requests are extremely verbose and cumbersome. Python's builtin urllib2 module provides most of the HTTP capabilities you should need, but the api is thoroughly broken. It requires an enormous amount of work (even method overrides) to perform the simplest of tasks. %if 0%{?with_python3} %package -n python3-%{upstream_name} Summary: HTTP library, written in Python, for human beings. Group: Development/Languages %description -n python3-%{upstream_name} Most existing Python modules for sending HTTP requests are extremely verbose and cumbersome. Python's builtin urllib2 module provides most of the HTTP capabilities you should need, but the api is thoroughly broken. It requires an enormous amount of work (even method overrides) to perform the simplest of tasks. %endif #if with_python3 %prep %setup -q -n %{upstream_name}-%{version} %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} 2to3 --write --nobackups %{py3dir} %endif # with_python3 %build CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build %if 0%{?with_python3} pushd %{py3dir} CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build popd %endif # with_python3 %install rm -rf $RPM_BUILD_ROOT %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd %endif # with_python3 # no tests provided %check %{__python} setup.py test %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py test popd %endif # with_python3 %clean rm -rf $RPM_BUILD_ROOT %files %doc HISTORY.rst LICENSE MANIFEST.in NOTICE PKG-INFO README.rst requirements.txt setup.cfg %{python_sitelib}/* %if 0%{?with_python3} %files -n python3-%{upstream_name} %doc HISTORY.rst LICENSE MANIFEST.in NOTICE PKG-INFO README.rst requirements.txt setup.cfg %{python3_sitelib}/* %endif # with_python3 %changelog * Wed Jul 23 2014 Adam Miller - 2.3.0-1 - Initial package for Fedora