Blob Blame Raw
# Macros for py2/py3 compatibility
%if 0%{?fedora} || 0%{?rhel} > 7
%global pyver %{python3_pkgversion}
%global pyver 2
%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 sname cinderclient

%global with_doc 1

%global common_desc \
Client library (cinderclient python module) and command line utility \
(cinder) for interacting with OpenStack Cinder (Block Storage) API.

Name:             python-cinderclient
Version:          5.0.0
Release:          2%{?dist}
Summary:          Python API and CLI for OpenStack Cinder

License:          ASL 2.0

BuildArch:        noarch

BuildRequires:    git


%package -n python%{pyver}-%{sname}
Summary:          Python API and CLI for OpenStack Cinder
%{?python_provide:%python_provide python%{pyver}-%{sname}}

BuildRequires:    python%{pyver}-devel
BuildRequires:    python%{pyver}-setuptools
BuildRequires:    python%{pyver}-pbr
# Handle python2 exception
%if %{pyver} == 2
BuildRequires:    python-d2to1
BuildRequires:    python%{pyver}-d2to1
Requires:         python%{pyver}-babel
Requires:         python%{pyver}-pbr
Requires:         python%{pyver}-prettytable
Requires:         python%{pyver}-requests
Requires:         python%{pyver}-six
Requires:         python%{pyver}-keystoneauth1 >= 3.4.0
Requires:         python%{pyver}-oslo-i18n >= 3.15.3
Requires:         python%{pyver}-oslo-utils >= 3.33.0
Requires:         python%{pyver}-simplejson

%description -n python%{pyver}-%{sname}

%if 0%{?with_doc}
%package doc
Summary:          Documentation for OpenStack Cinder API Client
Group:            Documentation

BuildRequires:    python%{pyver}-reno
BuildRequires:    python%{pyver}-sphinx
BuildRequires:    python%{pyver}-openstackdocstheme

%description      doc

This package contains auto-generated documentation.

%autosetup -n %{name}-%{upstream_version} -S git

# Remove bundled egg-info
rm -rf python_cinderclient.egg-info

# Let RPM handle the requirements
rm -f {,test-}requirements.txt


%if 0%{?with_doc}
sphinx-build-%{pyver} -W -b html doc/source doc/build/html
sphinx-build-%{pyver} -W -b man doc/source doc/build/man

# Fix hidden-file-or-dir warnings
rm -fr doc/build/html/.doctrees doc/build/html/.buildinfo

# Create a versioned binary for backwards compatibility until everything is pure py3
ln -s cinder %{buildroot}%{_bindir}/cinder-%{pyver}

# Delete tests
rm -fr %{buildroot}%{pyver_sitelib}/cinderclient/tests

install -p -D -m 644 tools/cinder.bash_completion %{buildroot}%{_sysconfdir}/bash_completion.d/cinder.bash_completion

%if 0%{?with_doc}
install -p -D -m 644 doc/build/man/cinder.1 %{buildroot}%{_mandir}/man1/cinder.1

%files -n python%{pyver}-%{sname}
%doc README.rst
%license LICENSE
%if 0%{?with_doc}

%if 0%{?with_doc}
%files doc
%doc doc/build/html

* Thu Jan 30 2020 Fedora Release Engineering <> - 5.0.0-2
- Rebuilt for

* Tue Nov 05 2019 Alfredo Moralejo <> 5.0.0-1
- Update to upstream version 5.0.0

* Thu Oct 03 2019 Miro Hrončok <> - 4.2.0-4
- Rebuilt for Python 3.8.0rc1 (#1748018)

* Mon Aug 19 2019 Miro Hrončok <> - 4.2.0-3
- Rebuilt for Python 3.8

* Fri Jul 26 2019 Fedora Release Engineering <> - 4.2.0-2
- Rebuilt for

* Sun May 19 2019 RDO <> 4.2.0-1
- Update to 4.2.0

* Mon Mar 11 2019 RDO <> 4.1.0-1
- Update to 4.1.0