%global pyname python-cloudflare
%global pkgname cloudflare
%if 0%{?rhel} && 0%{?rhel} <= 7
%bcond_with python3
%else
%bcond_without python3
%endif
Name: python-%{pkgname}
Version: 2.1.0
Release: 7%{?dist}
Summary: Python wrapper for the Cloudflare Client API v4
License: MIT
URL: https://pypi.python.org/pypi/%{pkgname}
Source0: https://github.com/cloudflare/%{pyname}/archive/%{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-%{pkgname}
Requires: python2-future
Requires: python2-requests
%if 0%{?fedora} > 27
Requires: python2-pyyaml
%else
Requires: PyYAML
%endif
Summary: %{summary}
%{?python_provide:%python_provide python2-%{pkgname}}
%description -n python2-%{pkgname}
Python wrapper library for the Cloudflare Client API v4.
This is the Python 2 version of the package.
%if %{with python3}
%package -n python3-%{pkgname}
Requires: python3-future
Requires: python3-PyYAML
Requires: python3-requests
Summary: %{summary}
%{?python_provide:%python_provide python3-%{pkgname}}
%description -n python3-%{pkgname}
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}
# Remove shebangs
sed -i -e '1!b' -e '\~^#!/usr/bin/env python~d' cli4/*.py
%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 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 examples
rm -rf %{buildroot}%{python3_sitelib}/examples
sed -i '/^examples/d' %{buildroot}%{python3_sitelib}/cloudflare-%{version}*.egg-info/{SOURCES,top_level}.txt
%endif
install -pD cli4/cli4.man %{buildroot}%{_mandir}/man1/cli4.1
%files -n python2-%{pkgname}
%license LICENSE
%doc README.rst
%if ! %{with python3}
%{_bindir}/cli4
%doc %attr(0644,root,root) %{_mandir}/man1/cli4.1*
%endif
%{python2_sitelib}/cli4
%{python2_sitelib}/CloudFlare
%{python2_sitelib}/cloudflare-%{version}*.egg-info
%if %{with python3}
%files -n python3-%{pkgname}
%license LICENSE
%doc README.rst
%{_bindir}/cli4
%doc %attr(0644,root,root) %{_mandir}/man1/cli4.1*
%{python3_sitelib}/cli4
%{python3_sitelib}/CloudFlare
%{python3_sitelib}/cloudflare-%{version}*.egg-info
%endif
%changelog
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 2.1.0-7
- Rebuilt for Python 3.7
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 2.1.0-6
- Rebuilt for Python 3.7
* Wed Apr 04 2018 Eli Young <elyscape@gmail.com> - 2.1.0-5
- Fix man page permissions
* Wed Apr 04 2018 Eli Young <elyscape@gmail.com> - 2.1.0-4
- Add cli4 man page
* 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)