%if 0%{?fedora} || 0%{?rhel} >= 8
%bcond_without python3
%global py2pkg_suffix 2
%else
%bcond_with python3
%endif # 0#{?fedora} || 0#{?rhel} >= 8
%global pypi_name psycogreen
%global common_desc \
The psycogreen package enables psycopg2 to work with co-routine libraries, \
using asynchronous calls internally but offering a blocking interface so \
that regular code can run unmodified. Psycopg offers co-routines support \
since release 2.2. Because the main module is a C extension it cannot be \
monkey-patched to become co-routine-friendly. Instead it exposes a hook \
that co-routine libraries can use to install a function integrating with \
their event scheduler. Psycopg will call the function whenever it \
executes a libpq call that may block. Psycogreen is a collection of “wait \
callbacks” useful to integrate Psycopg with different co-routine libraries.
Name: python-%{pypi_name}
Version: 1.0
Release: 1%{?dist}
Summary: Psycopg2 integration with co-routine libraries
License: BSD
URL: https://pypi.python.org/pypi/%{pypi_name}
Source0: https://files.pythonhosted.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
%description
%{common_desc}
%package -n python2-%{pypi_name}
Summary: %{summary}
BuildRequires: python%{?py2pkg_suffix}-devel
BuildRequires: python%{?py2pkg_suffix}-setuptools
Requires: python%{?py2pkg_suffix}-eventlet
Requires: python%{?py2pkg_suffix}-gevent
Requires: python%{?py2pkg_suffix}-psycopg2
%{?python_provide:%python_provide python2-%{pypi_name}}
%description -n python2-%{pypi_name}
%{common_desc}
%if %{with python3}
%package -n python3-%{pypi_name}
Summary: %{summary}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
Requires: python3-eventlet
Requires: python3-gevent
Requires: python3-psycopg2
%{?python_provide:%python_provide python3-%{pypi_name}}
%description -n python3-%{pypi_name}
%{common_desc}
%endif # with python3
%prep
%autosetup -n %{pypi_name}-%{version}
%build
%py2_build
%if %{with python3}
%py3_build
%endif # with python3
%install
%if %{with python3}
%py3_install
%endif # with python3
%py2_install
%files -n python2-%{pypi_name}
%license COPYING
%doc PKG-INFO README.rst
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info
%if %{with python3}
%files -n python3-%{pypi_name}
%license COPYING
%doc PKG-INFO README.rst
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
%endif # with python3
%changelog
* Tue Sep 27 2016 Björn Esser <fedora@besser82.io> - 1.0-1
- Initial import (rhbz 1379421)
* Tue Sep 27 2016 Björn Esser <fedora@besser82.io> - 1.0-0.2
- Updated with suggestions from:
https://bugzilla.redhat.com/show_bug.cgi?id=1379421#c1
- Enabled Python 3
* Sun Sep 25 2016 Björn Esser <fedora@besser82.io> - 1.0-0.1
- Initial package (rhbz 1379421)