CentOS 8: python-heatclient should use python3

Change python to python3
use the spec file contained in python-heatclient srpm
as the base.
Added required changes for stx.

Change-Id: Ibb5db5dd0b2147bee9e57c7c62356e9544743965
Story: 2006729
Task: 38643
Signed-off-by: Yong Fu <fuyong@neusoft.com>
This commit is contained in:
Yong Fu 2020-06-09 17:03:48 +08:00 committed by Long Li
parent 2201c17252
commit 23ec7dc69f

View File

@ -1,12 +1,19 @@
# 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}}
%global pyver_build_wheel %{expand:%{py%{pyver}_build_wheel}}
# End of macros for py2/py3 compatibility
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
%global with_doc 1
%global sname heatclient
%global with_doc 0
%if 0%{?fedora}
%global with_python3 1
%endif
%global common_desc \
This is a client for the OpenStack Heat API. There's a Python API (the \
@ -27,85 +34,61 @@ BuildArch: noarch
%description
%{common_desc}
%package -n python2-%{sname}
%package -n python%{pyver}-%{sname}
Summary: Python API and CLI for OpenStack Heat
%{?python_provide:%python_provide python2-heatclient}
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-pip
BuildRequires: python2-wheel
BuildRequires: python2-pbr
%{?python_provide:%python_provide python%{pyver}-heatclient}
%if %{pyver} == 3
Obsoletes: python2-%{sname} < %{version}-%{release}
%endif
BuildRequires: python%{pyver}-devel
BuildRequires: python%{pyver}-setuptools
BuildRequires: python%{pyver}-pbr
BuildRequires: python%{pyver}-wheel
BuildRequires: git
Requires: python2-babel
Requires: python2-iso8601
Requires: python2-keystoneauth1 >= 3.4.0
Requires: python2-osc-lib >= 1.8.0
Requires: python2-prettytable
Requires: python2-pbr
Requires: python2-six
Requires: python2-oslo-serialization >= 2.18.0
Requires: python2-oslo-utils >= 3.33.0
Requires: python2-oslo-i18n >= 3.15.3
Requires: python2-swiftclient >= 3.2.0
Requires: python2-requests
Requires: python2-cliff
%if 0%{?fedora} > 0
Requires: python2-pyyaml
%else
Requires: python%{pyver}-babel
Requires: python%{pyver}-iso8601
Requires: python%{pyver}-keystoneauth1 >= 3.4.0
Requires: python%{pyver}-osc-lib >= 1.8.0
Requires: python%{pyver}-prettytable
Requires: python%{pyver}-pbr
Requires: python%{pyver}-six
Requires: python%{pyver}-oslo-serialization >= 2.18.0
Requires: python%{pyver}-oslo-utils >= 3.33.0
Requires: python%{pyver}-oslo-i18n >= 3.15.3
Requires: python%{pyver}-swiftclient >= 3.2.0
Requires: python%{pyver}-requests
Requires: python%{pyver}-cliff
# Handle python2 exception
%if %{pyver} == 2
Requires: PyYAML
%else
Requires: python%{pyver}-PyYAML
%endif
%description -n python2-%{sname}
%description -n python%{pyver}-%{sname}
%{common_desc}
%if 0%{?with_python3}
%package -n python3-%{sname}
Summary: Python API and CLI for OpenStack Heat
%{?python_provide:%python_provide python3-heatclient}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pbr
Requires: python3-babel
Requires: python3-cliff
Requires: python3-iso8601
Requires: python3-keystoneauth1 >= 3.4.0
Requires: python3-osc-lib >= 1.8.0
Requires: python3-prettytable
Requires: python3-pbr
Requires: python3-six
Requires: python3-oslo-serialization >= 2.18.0
Requires: python3-oslo-utils >= 3.33.0
Requires: python3-oslo-i18n >= 3.15.3
Requires: python3-swiftclient >= 3.2.0
Requires: python3-requests
Requires: python3-PyYAML
%description -n python3-%{sname}
%{common_desc}
%endif
%if 0%{?with_doc}
%package doc
Summary: Documentation for OpenStack Heat API Client
BuildRequires: python2-sphinx
BuildRequires: python2-sphinxcontrib-apidoc
BuildRequires: python2-openstackdocstheme
BuildRequires: python2-babel
BuildRequires: python2-iso8601
BuildRequires: python2-keystoneauth1
BuildRequires: python2-osc-lib
BuildRequires: python2-prettytable
BuildRequires: python2-pbr
BuildRequires: python2-six
BuildRequires: python2-oslo-serialization
BuildRequires: python2-oslo-utils
BuildRequires: python2-oslo-i18n
BuildRequires: python2-swiftclient
BuildRequires: python2-requests
BuildRequires: python2-cliff
BuildRequires: python%{pyver}-sphinx
BuildRequires: python%{pyver}-openstackdocstheme
BuildRequires: python%{pyver}-babel
BuildRequires: python%{pyver}-iso8601
BuildRequires: python%{pyver}-keystoneauth1
BuildRequires: python%{pyver}-osc-lib
BuildRequires: python%{pyver}-prettytable
BuildRequires: python%{pyver}-pbr
BuildRequires: python%{pyver}-six
BuildRequires: python%{pyver}-oslo-serialization
BuildRequires: python%{pyver}-oslo-utils
BuildRequires: python%{pyver}-oslo-i18n
BuildRequires: python%{pyver}-swiftclient
BuildRequires: python%{pyver}-requests
BuildRequires: python%{pyver}-cliff
%description doc
%{common_desc}
@ -120,46 +103,30 @@ rm -rf {test-,}requirements.txt tools/{pip,test}-requires
%build
export PBR_VERSION=%{version}
%py2_build
%py2_build_wheel
%if 0%{?with_python3}
%py3_build
%endif
%{pyver_build}
%{pyver_build_wheel}
%install
export PBR_VERSION=%{version}
%if 0%{?with_python3}
%py3_install
echo "%{version}" > %{buildroot}%{python3_sitelib}/heatclient/versioninfo
mv %{buildroot}%{_bindir}/heat %{buildroot}%{_bindir}/heat-%{python3_version}
ln -s ./heat-%{python3_version} %{buildroot}%{_bindir}/heat-3
# Delete tests
rm -fr %{buildroot}%{python3_sitelib}/heatclient/tests
%endif
%py2_install
echo "%{version}" > %{buildroot}%{python2_sitelib}/heatclient/versioninfo
mv %{buildroot}%{_bindir}/heat %{buildroot}%{_bindir}/heat-%{python2_version}
ln -s ./heat-%{python2_version} %{buildroot}%{_bindir}/heat-2
ln -s ./heat-2 %{buildroot}%{_bindir}/heat
%{pyver_install}
echo "%{version}" > %{buildroot}%{pyver_sitelib}/heatclient/versioninfo
# Create a versioned binary for backwards compatibility until everything is pure py3
ln -s heat %{buildroot}%{_bindir}/heat-%{pyver}
mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d
install -pm 644 tools/heat.bash_completion \
%{buildroot}%{_sysconfdir}/bash_completion.d/heat
# Delete tests
rm -fr %{buildroot}%{python2_sitelib}/heatclient/tests
rm -fr %{buildroot}%{pyver_sitelib}/heatclient/tests
%if 0%{?with_doc}
export PYTHONPATH=.
sphinx-build -W -b html doc/source doc/build/html
sphinx-build-%{pyver} -W -b html doc/source doc/build/html
# Fix hidden-file-or-dir warnings
rm -fr doc/build/html/.doctrees doc/build/html/.buildinfo
# generate man page
sphinx-build -W -b man doc/source doc/build/man
sphinx-build-%{pyver} -W -b man doc/source doc/build/man
install -p -D -m 644 doc/build/man/heat.1 %{buildroot}%{_mandir}/man1/heat.1
%endif
@ -167,33 +134,17 @@ install -p -D -m 644 doc/build/man/heat.1 %{buildroot}%{_mandir}/man1/heat.1
mkdir -p $RPM_BUILD_ROOT/wheels
install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/
%files -n python2-%{sname}
%files -n python%{pyver}-%{sname}
%doc README.rst
%license LICENSE
%{python2_sitelib}/heatclient
%{python2_sitelib}/*.egg-info
%{pyver_sitelib}/heatclient
%{pyver_sitelib}/*.egg-info
%{_sysconfdir}/bash_completion.d
%if 0%{?with_doc}
%{_mandir}/man1/heat.1.gz
%endif
%{_bindir}/heat
%{_bindir}/heat-2
%{_bindir}/heat-%{python2_version}
%if 0%{?with_python3}
%files -n python3-%{sname}
%license LICENSE
%doc README.rst
%{python3_sitelib}/%{sname}
%{python3_sitelib}/*.egg-info
%{_sysconfdir}/bash_completion.d
%if 0%{?with_doc}
%{_mandir}/man1/heat.1.gz
%endif
%{_bindir}/heat-3
%{_bindir}/heat-%{python3_version}
%endif
%{_bindir}/heat-%{pyver}
%if 0%{?with_doc}
%files doc
@ -201,7 +152,6 @@ install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/
%license LICENSE
%endif
%package wheels
Summary: %{name} wheels
@ -211,8 +161,7 @@ Contains python wheels for %{name}
%files wheels
/wheels/*
%changelog
* Fri Aug 10 2018 RDO <dev@lists.rdoproject.org> 1.16.1-1
- Update to 1.16.1
* Fri Sep 20 2019 RDO <dev@lists.rdoproject.org> 1.18.0-1
- Update to 1.18.0