Blob Blame History Raw
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}

%global sname swiftclient

%if 0%{?fedora}
%global with_python3 1
%endif

Name:       python-swiftclient
Version:    3.4.0
Release:    5%{?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
Client library and command line utility for interacting with Openstack
Object Storage API.

%package -n python2-%{sname}
Summary:    Client Library for OpenStack Object Storage API
%{?python_provide:%python_provide python2-swiftclient}

BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-pbr

Requires:      python2-futures
Requires:      python2-requests
Requires:      python2-six
Requires:      python2-keystoneclient

%description -n python2-%{sname}
Client library and command line utility for interacting with Openstack
Object Storage API.

%if 0%{?with_python3}
%package -n python3-%{sname}
Summary:    Client Library for OpenStack Object Storage API
%{?python_provide:%python_provide python3-swiftclient}

BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pbr

Requires:      python3-requests
Requires:      python3-six
Requires:      python3-keystoneclient

%description -n python3-%{sname}
Client library and command line utility for interacting with Openstack
Object Storage API.
%endif

%package doc
Summary:    Documentation for OpenStack Object Storage API Client
Group:      Documentation

BuildRequires: python2-sphinx
BuildRequires: python2-oslo-sphinx
BuildRequires: python2-futures

%description doc
Documentation for the client library for interacting with Openstack
Object Storage API.

%prep
%setup -q -n %{name}-%{upstream_version}

# Let RPM handle the dependencies
rm -f test-requirements.txt requirements.txt

%build
%py2_build
%if 0%{?with_python3}
%py3_build
%endif

%install
%if 0%{?with_python3}
%py3_install
mv %{buildroot}%{_bindir}/swift %{buildroot}%{_bindir}/swift-%{python3_version}
ln -s ./swift-%{python3_version} %{buildroot}%{_bindir}/swift-3
# Delete tests
rm -fr %{buildroot}%{python3_sitelib}/swiftclient/tests
%endif

%py2_install
mv %{buildroot}%{_bindir}/swift %{buildroot}%{_bindir}/swift-%{python2_version}
ln -s ./swift-%{python2_version} %{buildroot}%{_bindir}/swift-2

ln -s ./swift-2 %{buildroot}%{_bindir}/swift

# Delete tests
rm -fr %{buildroot}%{python2_sitelib}/swiftclient/tests

%{__python2} setup.py build_sphinx -b html
rm -rf doc/build/html/.{doctrees,buildinfo}

%{__python2} setup.py build_sphinx -b man
install -p -D -m 644 doc/build/man/*.1 %{buildroot}%{_mandir}/man1/

%files -n python2-%{sname}
%doc README.rst
%license LICENSE
%{python2_sitelib}/swiftclient
%{python2_sitelib}/*.egg-info
%{_bindir}/swift
%{_bindir}/swift-2
%{_bindir}/swift-%{python2_version}
%{_mandir}/man1/*

%if 0%{?with_python3}
%files -n python3-%{sname}
%license LICENSE
%doc README.rst
%{python3_sitelib}/%{sname}
%{python3_sitelib}/*.egg-info
%{_bindir}/swift-3
%{_bindir}/swift-%{python3_version}
%endif

%files doc
%doc doc/build/html
%license LICENSE

%changelog
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro HronĨok <mhroncok@redhat.com> - 3.4.0-4
- Rebuilt for Python 3.7

* Fri Feb 09 2018 Iryna Shcherbina <ishcherb@redhat.com> - 3.4.0-3
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Fri Aug 11 2017 Alfredo Moralejo <amoralej@redhat.com> 3.4.0-1
- Update to 3.4.0