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

# Command name
%global cname openstack

# library name
%global sname %{cname}client

%global with_doc 1

%global common_desc \
python-%{sname} is a unified command-line client for the OpenStack APIs. \
It is a thin wrapper to the stock python-*client modules that implement the \
actual REST API client actions.

Name:             python-%{sname}
Version:          4.0.0
Release:          2%{?dist}
Summary:          OpenStack Command-line Client

License:          ASL 2.0
URL:    {name}

BuildArch:        noarch

BuildRequires:    git


%package -n python%{pyver}-%{sname}
Summary:    OpenStack Command-line Client
%{?python_provide:%python_provide python%{pyver}-%{sname}}
%if %{pyver} == 3
Obsoletes: python2-%{sname} < %{version}-%{release}

BuildRequires:    python%{pyver}-devel
BuildRequires:    python%{pyver}-setuptools
BuildRequires:    python%{pyver}-pbr
BuildRequires:    python%{pyver}-six
BuildRequires:    python%{pyver}-oslo-i18n
BuildRequires:    python%{pyver}-oslo-utils
BuildRequires:    python%{pyver}-requests
BuildRequires:    python%{pyver}-glanceclient
BuildRequires:    python%{pyver}-keystoneclient
BuildRequires:    python%{pyver}-novaclient
BuildRequires:    python%{pyver}-cinderclient
BuildRequires:    python%{pyver}-mock
BuildRequires:    python%{pyver}-os-client-config
BuildRequires:    python%{pyver}-cliff
BuildRequires:    python%{pyver}-simplejson
%if %{pyver} == 2
BuildRequires:    python-d2to1
BuildRequires:    python-requests-mock
BuildRequires:    python%{pyver}-d2to1
BuildRequires:    python%{pyver}-requests-mock

# Required to compile translation files
BuildRequires:    python%{pyver}-babel
# Required for unit tests
BuildRequires:    python%{pyver}-stestr
BuildRequires:    python%{pyver}-osc-lib-tests
BuildRequires:    python%{pyver}-fixtures
BuildRequires:    python%{pyver}-oslotest
BuildRequires:    python%{pyver}-reno
BuildRequires:    python%{pyver}-requestsexceptions
BuildRequires:    python%{pyver}-openstacksdk

Requires:         python%{pyver}-pbr
Requires:         python%{pyver}-babel
Requires:         python%{pyver}-openstacksdk >= 0.17.0
Requires:         python%{pyver}-oslo-i18n >= 3.15.3
Requires:         python%{pyver}-oslo-utils >= 3.33.0
Requires:         python%{pyver}-glanceclient >= 1:2.8.0
Requires:         python%{pyver}-keystoneauth1 >= 3.6.2
Requires:         python%{pyver}-keystoneclient >= 1:3.17.0
Requires:         python%{pyver}-novaclient >= 1:15.0.0
Requires:         python%{pyver}-cinderclient >= 3.3.0
Requires:         python%{pyver}-neutronclient >= 6.7.0
Requires:         python%{pyver}-six >= 1.10.0
Requires:         python%{pyver}-osc-lib >= 1.14.0
Requires:         python%{pyver}-cliff

Requires:         python-%{sname}-lang = %{version}-%{release}

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

%if 0%{?with_doc}
%package -n python-%{sname}-doc
Summary:          Documentation for OpenStack Command-line Client

BuildRequires:    python%{pyver}-sphinx
BuildRequires:    python%{pyver}-openstackdocstheme
BuildRequires:    python%{pyver}-sphinxcontrib-apidoc

Requires: python%{pyver}-%{sname} = %{version}-%{release}

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

This package contains auto-generated documentation.

%package  -n python-%{sname}-lang
Summary:   Translation files for Openstackclient

%description -n python-%{sname}-lang
Translation files for Openstackclient

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

# We handle requirements ourselves, pkg_resources only bring pain
rm -rf *requirements.txt


# Generate i18n files
%{pyver_bin} compile_catalog -d build/lib/%{sname}/locale


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

%if 0%{?with_doc}
sphinx-build-%{pyver} -b html doc/source doc/build/html
sphinx-build-%{pyver} -b man doc/source doc/build/man
install -p -D -m 644 doc/build/man/%{cname}.1 %{buildroot}%{_mandir}/man1/%{cname}.1

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

# Install i18n .mo files (.po and .pot are not required)
install -d -m 755 %{buildroot}%{_datadir}
rm -f %{buildroot}%{pyver_sitelib}/%{sname}/locale/*/LC_*/%{sname}*po
rm -f %{buildroot}%{pyver_sitelib}/%{sname}/locale/*pot
mv %{buildroot}%{pyver_sitelib}/%{sname}/locale %{buildroot}%{_datadir}/locale
rm -rf %{buildroot}%{pyver_sitelib}/%{sname}/locale

# Find language files
%find_lang %{sname} --all-name

export PYTHON=%{__python}
stestr-%{pyver} run

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

%files -n python-%{sname}-doc
%license LICENSE
%doc doc/build/html

%files -n python-%{sname}-lang -f %{sname}.lang
%license LICENSE

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

* Fri Nov 08 2019 Alfredo Moralejo <> 4.0.0-1
- Update to upstream version 4.0.0

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

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

* Mon Jul 29 2019 Alfredo Moralejo <> - 3.18.0-3
- Remove unneeded osprofiler as BR.

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

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