ecfa22e
%global pyname python-cloudflare
ecfa22e
%global pkgname cloudflare
1f94776
1f94776
%if 0%{?rhel} && 0%{?rhel} <= 7
1f94776
%bcond_with python3
1f94776
%else
1f94776
%bcond_without python3
1f94776
%endif
1f94776
1816765
%if 0%{?fedora} && 0%{?fedora} >= 30
1816765
%bcond_with python2
1816765
%else
1816765
%bcond_without python2
1816765
%endif
1816765
ecfa22e
Name:           python-%{pkgname}
1d02180
Version:        2.3.0
9c7348a
Release:        2%{?dist}
1f94776
Summary:        Python wrapper for the Cloudflare Client API v4
1f94776
1f94776
License:        MIT
ecfa22e
URL:            https://pypi.python.org/pypi/%{pkgname}
ecfa22e
Source0:        https://github.com/cloudflare/%{pyname}/archive/%{version}.tar.gz
1f94776
edbe972
# TODO: Remove this once jsonlines is packaged
edbe972
Patch0:         remove-jsonlines.patch
c53affe
Patch1:         remove-shebangs.patch
53d162e
Patch2:         remove-examples.patch
edbe972
1f94776
BuildArch:      noarch
1f94776
1816765
%if %{with python2}
1f94776
BuildRequires:  python2-devel
1f94776
BuildRequires:  python2-future
Nick Bebout 1ce4cdc
BuildRequires:  python2-requests
1f94776
BuildRequires:  python2-setuptools
1f94776
1f94776
%if 0%{?fedora} > 27
1f94776
BuildRequires:  python2-pyyaml
1f94776
%else
1f94776
BuildRequires:  PyYAML
1f94776
%endif
1816765
%endif
1f94776
1f94776
%if %{with python3}
1f94776
BuildRequires:  python3-devel
1f94776
BuildRequires:  python3-future
1f94776
BuildRequires:  python3-PyYAML
1f94776
BuildRequires:  python3-requests
1f94776
BuildRequires:  python3-setuptools
1f94776
%endif
1f94776
0400909
BuildRequires:  sed
0400909
1f94776
%description
1f94776
Python wrapper library for the Cloudflare Client API v4.
1f94776
1816765
%if %{with python2}
ecfa22e
%package -n python2-%{pkgname}
1f94776
Requires:       python2-future
Nick Bebout 1ce4cdc
Requires:       python2-requests
1f94776
1f94776
%if 0%{?fedora} > 27
1f94776
Requires:       python2-pyyaml
1f94776
%else
1f94776
Requires:       PyYAML
1f94776
%endif
1f94776
1f94776
Summary:        %{summary}
ecfa22e
%{?python_provide:%python_provide python2-%{pkgname}}
1f94776
ecfa22e
%description -n python2-%{pkgname}
1f94776
Python wrapper library for the Cloudflare Client API v4.
1f94776
1f94776
This is the Python 2 version of the package.
1816765
%endif
1f94776
1f94776
%if %{with python3}
ecfa22e
%package -n python3-%{pkgname}
050715a
Requires:       python3-future
050715a
Requires:       python3-PyYAML
050715a
Requires:       python3-requests
1f94776
1f94776
Summary:        %{summary}
ecfa22e
%{?python_provide:%python_provide python3-%{pkgname}}
1f94776
ecfa22e
%description -n python3-%{pkgname}
1f94776
Python wrapper library for the Cloudflare Client API v4.
1f94776
1f94776
This is the Python 3 version of the package.
1f94776
%endif
1f94776
1f94776
%prep
1f94776
%autosetup -p1 -n %{pyname}-%{version}
ff873b6
# Remove shebangs
ff873b6
sed -i -e '1!b' -e '\~^#!/usr/bin/env python~d' cli4/*.py
1f94776
1f94776
%build
1816765
%if %{with python2}
1f94776
%py2_build
1816765
%endif
1816765
1f94776
%if %{with python3}
1f94776
%py3_build
1f94776
%endif
1f94776
1f94776
%check
1816765
%if %{with python2}
1f94776
%{__python2} setup.py test
1816765
%endif
1816765
1f94776
%if %{with python3}
1f94776
%{__python3} setup.py test
1f94776
%endif
1f94776
1f94776
%install
0400909
# Remove examples
53d162e
rm -rf build/lib/examples
1816765
1816765
%if %{with python2}
53d162e
%py2_install
1816765
%endif
1816765
1f94776
%if %{with python3}
1f94776
%py3_install
1f94776
%endif
1f94776
ecfa22e
install -pD cli4/cli4.man %{buildroot}%{_mandir}/man1/cli4.1
ecfa22e
1816765
%if %{with python2}
ecfa22e
%files -n python2-%{pkgname}
1f94776
%license LICENSE
1f94776
%doc README.rst
1f94776
%if ! %{with python3}
1f94776
%{_bindir}/cli4
c6798d7
%doc %attr(0644,root,root) %{_mandir}/man1/cli4.1*
1f94776
%endif
1f94776
%{python2_sitelib}/cli4
1f94776
%{python2_sitelib}/CloudFlare
1f94776
%{python2_sitelib}/cloudflare-%{version}*.egg-info
1816765
%endif
1f94776
1f94776
%if %{with python3}
ecfa22e
%files -n python3-%{pkgname}
1f94776
%license LICENSE
1f94776
%doc README.rst
1f94776
%{_bindir}/cli4
c6798d7
%doc %attr(0644,root,root) %{_mandir}/man1/cli4.1*
1f94776
%{python3_sitelib}/cli4
1f94776
%{python3_sitelib}/CloudFlare
1f94776
%{python3_sitelib}/cloudflare-%{version}*.egg-info
1f94776
%endif
1f94776
1f94776
%changelog
9c7348a
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.0-2
9c7348a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
9c7348a
1d02180
* Mon Jul 01 2019 Eli Young <elyscape@gmail.com> - 2.3.0-1
1d02180
- Update to 2.3.0 (#1712059)
1d02180
504501f
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.0-12
504501f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
504501f
1816765
* Thu Dec 13 2018 Eli Young <elyscape@gmail.com> - 2.1.0-11
1816765
- Remove Python 2 package in Fedora 30+ (#1658535)
1816765
12a09ce
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.0-10
12a09ce
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
12a09ce
53d162e
* Fri Jul 06 2018 Eli Young <elyscape@gmail.com> - 2.1.0-9
53d162e
- Simplify example removal
53d162e
c53affe
* Fri Jun 29 2018 Eli Young <elyscape@gmail.com> - 2.1.0-8
c53affe
- Remove unnecessary shebangs
c53affe
4d21bb5
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 2.1.0-7
4d21bb5
- Rebuilt for Python 3.7
4d21bb5
5924d9f
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 2.1.0-6
5924d9f
- Rebuilt for Python 3.7
5924d9f
c6798d7
* Wed Apr 04 2018 Eli Young <elyscape@gmail.com> - 2.1.0-5
c6798d7
- Fix man page permissions
c6798d7
ecfa22e
* Wed Apr 04 2018 Eli Young <elyscape@gmail.com> - 2.1.0-4
ecfa22e
- Add cli4 man page
ecfa22e
0400909
* Wed Apr 04 2018 Eli Young <elyscape@gmail.com> - 2.1.0-3
0400909
- Remove example scripts from egg info
bbe0886
- Remove unnecessary shebangs
0400909
050715a
* Wed Apr 04 2018 Eli Young <elyscape@gmail.com> - 2.1.0-2
050715a
- Fix python3 package dependencies (#1563427)
050715a
edbe972
* Tue Mar 27 2018 Eli Young <elyscape@gmail.com> - 2.1.0-1
edbe972
- Update to 2.1.0 (#1560758)
edbe972
Nick Bebout 1ce4cdc
* Mon Feb 26 2018 Nick Bebout <nb@usi.edu> - 2.0.4-2
Nick Bebout 1ce4cdc
- Add python2- prefix where available
Nick Bebout 1ce4cdc
1f94776
* Fri Feb 16 2018 Eli Young <elyscape@gmail.com> - 2.0.4-1
1f94776
- Initial package (#1546297)