# Macros for py2/py3 compatibility
%if 0%{?fedora} || 0%{?rhel} > 7
%global pyver %{python3_pkgversion}
%else
%global pyver 2
%endif
%global pyver_bin python%{pyver}
%global pyver_sitelib %{expand:%{python%{pyver}_sitelib}}
%global pyver_install %{expand:%{py%{pyver}_install}}
%global pyver_build %{expand:%{py%{pyver}_build}}
# End of macros for py2/py3 compatibility
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
%global with_doc 1
%global sname swiftclient
%global common_desc \
Client library and command line utility for interacting with Openstack \
Object Storage API.
Name: python-swiftclient
Version: 3.8.1
Release: 2%{?dist}
Summary: Client Library for OpenStack Object Storage API
License: ASL 2.0
URL: http://launchpad.net/python-swiftclient/
Source0: https://tarballs.openstack.org/%{name}/%{name}-%{version}.tar.gz
BuildArch: noarch
%description
%{common_desc}
%package -n python%{pyver}-%{sname}
Summary: Client Library for OpenStack Object Storage API
%{?python_provide:%python_provide python%{pyver}-swiftclient}
%if %{pyver} == 3
Obsoletes: python2-%{sname} < %{version}-%{release}
%endif
BuildRequires: python%{pyver}-devel
BuildRequires: python%{pyver}-setuptools
BuildRequires: python%{pyver}-pbr
Requires: python%{pyver}-requests
Requires: python%{pyver}-six
Requires: python%{pyver}-keystoneclient
# Handle python2 exception
%if %{pyver} == 2
Requires: python%{pyver}-futures
%endif
%description -n python%{pyver}-%{sname}
%{common_desc}
%if 0%{?with_doc}
%package doc
Summary: Documentation for OpenStack Object Storage API Client
Group: Documentation
BuildRequires: python%{pyver}-sphinx
BuildRequires: python%{pyver}-openstackdocstheme
# Handle python2 exception
%if %{pyver} == 2
BuildRequires: python%{pyver}-futures
%endif
%description doc
Documentation for the client library for interacting with Openstack
Object Storage API.
%endif
%prep
%setup -q -n %{name}-%{upstream_version}
# Let RPM handle the dependencies
rm -rf *requirements.txt
%build
%{pyver_build}
%install
%{pyver_install}
# Create a versioned binary for backwards compatibility until everything is pure py3
ln -s swift %{buildroot}%{_bindir}/swift-%{pyver}
# Delete tests
rm -fr %{buildroot}%{pyver_sitelib}/swiftclient/tests
%if 0%{?with_doc}
%{pyver_bin} setup.py build_sphinx -b html
rm -rf doc/build/html/.{doctrees,buildinfo}
%{pyver_bin} setup.py build_sphinx -b man
install -p -D -m 644 doc/build/man/*.1 %{buildroot}%{_mandir}/man1/
%endif
%files -n python%{pyver}-%{sname}
%doc README.rst
%license LICENSE
%{pyver_sitelib}/swiftclient
%{pyver_sitelib}/*.egg-info
%{_bindir}/swift
%{_bindir}/swift-%{pyver}
%{_mandir}/man1/*
%if 0%{?with_doc}
%files doc
%doc doc/build/html
%license LICENSE
%endif
%changelog
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.8.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Tue Nov 05 2019 Alfredo Moralejo <amoralej@redhat.com> 3.8.1-1
- Update to upstream version 3.8.1
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 3.7.0-4
- Rebuilt for Python 3.8.0rc1 (#1748018)
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 3.7.0-3
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Mar 11 2019 RDO <dev@lists.rdoproject.org> 3.7.0-1
- Update to 3.7.0