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 %python%{pyver}_sitelib
%global pyver_install %py%{pyver}_install
%global pyver_build %py%{pyver}_build
# End of macros for py2/py3 compatibility
%global pypi_name mistralclient
%global cliname   mistral
%global with_doc 1

%{!?upstream_version: %global upstream_version %{version}%{?milestone}}

%global common_desc \
Python client for Mistral REST API. Includes python library for Mistral API \
and Command Line Interface (CLI) library.

Name:           python-%{pypi_name}
Version:        3.8.0
Release:        4%{?dist}
Summary:        Python client for Mistral REST API

License:        ASL 2.0

BuildArch:      noarch


%package -n     python%{pyver}-%{pypi_name}
Summary:        Python client for Mistral REST API
%{?python_provide:%python_provide python%{pyver}-%{pypi_name}}
%if %{pyver} == 3
Obsoletes: python2-%{pypi_name} < %{version}-%{release}

BuildRequires:  python%{pyver}-devel
BuildRequires:  python%{pyver}-setuptools
BuildRequires:  python%{pyver}-pbr
BuildRequires:  git

Requires:       python%{pyver}-osc-lib >= 1.10.0
Requires:       python%{pyver}-oslo-i18n >= 3.15.3
Requires:       python%{pyver}-oslo-utils >= 3.33.0
Requires:       python%{pyver}-oslo-serialization >= 2.18.0
Requires:       python%{pyver}-pbr
Requires:       python%{pyver}-requests >= 2.14.2
Requires:       python%{pyver}-six >= 1.10.0
Requires:       python%{pyver}-stevedore >= 1.20.0
Requires:       python%{pyver}-keystoneauth1 >= 3.4.0
Requires:       python%{pyver}-cliff >= 2.8.0

# Handle python2 exception
%if %{pyver} == 2
Requires:       PyYAML >= 3.10
Requires:       python%{pyver}-PyYAML >= 3.10

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

%if 0%{with_doc}
# Documentation package
%package -n python-%{pypi_name}-doc
Summary:       Documentation for python client for Mistral REST API

BuildRequires: python%{pyver}-sphinx
BuildRequires: python%{pyver}-openstackdocstheme
BuildRequires: python%{pyver}-sphinxcontrib-apidoc
BuildRequires: python%{pyver}-oslotest
BuildRequires: python%{pyver}-stevedore
BuildRequires: python%{pyver}-oslo-utils
BuildRequires: python%{pyver}-oslo-i18n
BuildRequires: python%{pyver}-osc-lib
BuildRequires: python%{pyver}-cliff

# Handle python2 exception
%if %{pyver} == 2
BuildRequires: PyYAML
BuildRequires: python-requests-mock
BuildRequires: python%{pyver}-PyYAML
BuildRequires: python%{pyver}-requests-mock

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

This package contains documentation.

%autosetup -n %{name}-%{upstream_version} -S git
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
# Let RPM handle the dependencies
rm -f test-requirements.txt requirements.txt
# Remove the functional tests, we don't need them in the package
rm -rf mistralclient/tests/functional


%if 0%{with_doc}
# generate html docs
sphinx-build-%{pyver} -b html doc/source doc/build/html
# remove the sphinx-build-%{pyver} leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}


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

# Install bash completion scripts
mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d/
install -m 644 -T tools/mistral.bash_completion %{buildroot}%{_sysconfdir}/bash_completion.d/python-mistralclient

%files -n python%{pyver}-%{pypi_name}
%license LICENSE
%doc README.rst

%if 0%{with_doc}
%files -n python-%{pypi_name}-doc
%doc doc/build/html
%license LICENSE

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

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

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

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