%global pyname cloudflare
%if 0%{?rhel} && 0%{?rhel} <= 7
%bcond_with python3
%else
%bcond_without python3
%endif
Name: python-%{pyname}
Version: 2.1.0
Release: 3%{?dist}
Summary: Python wrapper for the Cloudflare Client API v4
License: MIT
URL: https://pypi.python.org/pypi/cloudflare
Source0: https://files.pythonhosted.org/packages/source/c/%{pyname}/%{pyname}-%{version}.tar.gz
# TODO: Remove this once jsonlines is packaged
Patch0: remove-jsonlines.patch
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python2-future
BuildRequires: python2-requests
BuildRequires: python2-setuptools
%if 0%{?fedora} > 27
BuildRequires: python2-pyyaml
%else
BuildRequires: PyYAML
%endif
%if %{with python3}
BuildRequires: python3-devel
BuildRequires: python3-future
BuildRequires: python3-PyYAML
BuildRequires: python3-requests
BuildRequires: python3-setuptools
%endif
BuildRequires: sed
%description
Python wrapper library for the Cloudflare Client API v4.
%package -n python2-%{pyname}
Requires: python2-future
Requires: python2-requests
%if 0%{?fedora} > 27
Requires: python2-pyyaml
%else
Requires: PyYAML
%endif
Summary: %{summary}
%{?python_provide:%python_provide python2-%{pyname}}
%description -n python2-%{pyname}
Python wrapper library for the Cloudflare Client API v4.
This is the Python 2 version of the package.
%if %{with python3}
%package -n python3-%{pyname}
Requires: python3-future
Requires: python3-PyYAML
Requires: python3-requests
Summary: %{summary}
%{?python_provide:%python_provide python3-%{pyname}}
%description -n python3-%{pyname}
Python wrapper library for the Cloudflare Client API v4.
This is the Python 3 version of the package.
%endif
%prep
%autosetup -p1 -n %{pyname}-%{version}
%build
%py2_build
%if %{with python3}
%py3_build
%endif
%check
%{__python2} setup.py test
%if %{with python3}
%{__python3} setup.py test
%endif
%install
%py2_install
# Remove shebangs
sed -i -e '1!b' -e '\~^#!/usr/bin/env python~d' %{buildroot}%{python2_sitelib}/cli4/*.py
# Remove examples
rm -rf %{buildroot}%{python2_sitelib}/examples
sed -i '/^examples/d' %{buildroot}%{python2_sitelib}/cloudflare-%{version}*.egg-info/{SOURCES,top_level}.txt
%if %{with python3}
%py3_install
# Remove shebangs
sed -i -e '1!b' -e '\~^#!/usr/bin/env python~d' %{buildroot}%{python3_sitelib}/cli4/*.py
# Remove examples
rm -rf %{buildroot}%{python3_sitelib}/examples
sed -i '/^examples/d' %{buildroot}%{python3_sitelib}/cloudflare-%{version}*.egg-info/{SOURCES,top_level}.txt
%endif
%files -n python2-%{pyname}
%license LICENSE
%doc README.rst
%if ! %{with python3}
%{_bindir}/cli4
%endif
%{python2_sitelib}/cli4
%{python2_sitelib}/CloudFlare
%{python2_sitelib}/cloudflare-%{version}*.egg-info
%if %{with python3}
%files -n python3-%{pyname}
%license LICENSE
%doc README.rst
%{_bindir}/cli4
%{python3_sitelib}/cli4
%{python3_sitelib}/CloudFlare
%{python3_sitelib}/cloudflare-%{version}*.egg-info
%endif
%changelog
* Wed Apr 04 2018 Eli Young <elyscape@gmail.com> - 2.1.0-3
- Remove example scripts from egg info
- Remove unnecessary shebangs
* Wed Apr 04 2018 Eli Young <elyscape@gmail.com> - 2.1.0-2
- Fix python3 package dependencies (#1563427)
* Tue Mar 27 2018 Eli Young <elyscape@gmail.com> - 2.1.0-1
- Update to 2.1.0 (#1560758)
* Mon Feb 26 2018 Nick Bebout <nb@usi.edu> - 2.0.4-2
- Add python2- prefix where available
* Fri Feb 16 2018 Eli Young <elyscape@gmail.com> - 2.0.4-1
- Initial package (#1546297)