%if 0%{?fedora} > 12 %global with_python3 1 %else %{!?__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 Name: python-beanbag Version: 1.9.2 Release: 1%{?dist} Summary: A helper module for accessing REST APIs License: MIT URL: https://github.com/ajtowns/beanbag BuildArch: noarch Source0: https://pypi.python.org/packages/source/b/beanbag/beanbag-%{version}.tar.gz BuildRequires: python2-devel BuildRequires: python-setuptools BuildRequires: python-nose BuildRequires: pytest BuildRequires: python-requests %if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-nose BuildRequires: python3-pytest BuildRequires: python3-requests %endif # if with_python3 %{?python_provide:%python_provide python-beanbag} Requires: python-requests %description BeanBag is a simple module that lets you access REST APIs in an easy way. For example: >>> import beanbag >>> github = beanbag.BeanBag("https://api.github.com") >>> watchers = github.repos.ajtowns.beanbag.watchers() >>> for w in watchers: ... print(w["login"]) See http://beanbag.readthedocs.org/ for more information. %package -n python3-beanbag Summary: A helper module for accessing REST APIs %{?python_provide:%python_provide python3-beanbag} Requires: python3-requests %description -n python3-beanbag BeanBag is a simple module that lets you access REST APIs in an easy way. For example: >>> import beanbag >>> github = beanbag.BeanBag("https://api.github.com") >>> watchers = github.repos.ajtowns.beanbag.watchers() >>> for w in watchers: ... print(w["login"]) See http://beanbag.readthedocs.org/ for more information. %prep %setup -q -n beanbag-%{version} %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|#!%{__python}|' %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 %check CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py nosetests || exit 1 %if 0%{?with_python3} pushd %{py3dir} CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py nosetests || exit 1 popd %endif # with_python3 %install # Must do the python3 install first because the scripts in /usr/bin are # overwritten with every setup.py install (and we want the python2 version # to be the default for now). %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install --skip-build --root %{buildroot} popd %endif # with_python3 %{__python} setup.py install --skip-build --root %{buildroot} %files %doc LICENSE README.rst %{python_sitelib}/beanbag* %if 0%{?with_python3} %files -n python3-beanbag %doc LICENSE README.rst %{python3_sitelib}/beanbag* %endif # with_python3 %changelog * Fri Jan 08 2016 Stanislav Ochotnicky - 1.9.2-1 - Initial version