CentOS 8: python-aodhclient should use python3
Change python to python3 get spec files from upstream to support python3 Change-Id: I7811a2cc6376276aa947585131f7e80f3512eefa Story: 2006729 Task: 38637 Signed-off-by: Yong Fu <fuyong@neusoft.com>
This commit is contained in:
parent
2201c17252
commit
40dddda33c
@ -1,10 +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
|
||||||
%global pypi_name aodhclient
|
%global pypi_name aodhclient
|
||||||
|
|
||||||
%if 0%{?fedora}
|
|
||||||
%global with_python3 1
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
|
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
|
||||||
|
%global with_doc 1
|
||||||
|
|
||||||
%global common_desc \
|
%global common_desc \
|
||||||
This is a client library for Aodh built on the Aodh API. It \
|
This is a client library for Aodh built on the Aodh API. It \
|
||||||
@ -24,43 +33,45 @@ BuildArch: noarch
|
|||||||
%description
|
%description
|
||||||
%{common_desc}
|
%{common_desc}
|
||||||
|
|
||||||
%package -n python2-%{pypi_name}
|
%package -n python%{pyver}-%{pypi_name}
|
||||||
Summary: Python API and CLI for OpenStack Aodh
|
Summary: Python API and CLI for OpenStack Aodh
|
||||||
%{?python_provide:%python_provide python2-%{pypi_name}}
|
%{?python_provide:%python_provide python%{pyver}-%{pypi_name}}
|
||||||
|
|
||||||
BuildRequires: python-setuptools
|
BuildRequires: python%{pyver}-setuptools
|
||||||
BuildRequires: python2-pip
|
BuildRequires: python%{pyver}-devel
|
||||||
BuildRequires: python2-wheel
|
BuildRequires: python%{pyver}-pbr
|
||||||
BuildRequires: python2-devel
|
BuildRequires: python%{pyver}-wheel
|
||||||
BuildRequires: python-pbr
|
|
||||||
BuildRequires: git
|
BuildRequires: git
|
||||||
|
|
||||||
Requires: python-pbr
|
Requires: python%{pyver}-pbr
|
||||||
Requires: python-cliff >= 1.14.0
|
Requires: python%{pyver}-cliff >= 1.14.0
|
||||||
Requires: python-oslo-i18n >= 1.5.0
|
Requires: python%{pyver}-oslo-i18n >= 1.5.0
|
||||||
Requires: python-oslo-serialization >= 1.4.0
|
Requires: python%{pyver}-oslo-serialization >= 1.4.0
|
||||||
Requires: python-oslo-utils >= 2.0.0
|
Requires: python%{pyver}-oslo-utils >= 2.0.0
|
||||||
Requires: python-keystoneauth1 >= 1.0.0
|
Requires: python%{pyver}-osprofiler >= 1.4.0
|
||||||
Requires: python-six >= 1.9.0
|
Requires: python%{pyver}-keystoneauth1 >= 1.0.0
|
||||||
Requires: python-osc-lib >= 1.0.1
|
Requires: python%{pyver}-six >= 1.9.0
|
||||||
Requires: python-osprofiler >= 1.4.0
|
Requires: python%{pyver}-osc-lib >= 1.0.1
|
||||||
|
# Handle python2 exception
|
||||||
|
%if %{pyver} == 2
|
||||||
Requires: pyparsing
|
Requires: pyparsing
|
||||||
|
%else
|
||||||
|
Requires: python%{pyver}-pyparsing
|
||||||
|
%endif
|
||||||
|
|
||||||
%description -n python2-%{pypi_name}
|
%description -n python%{pyver}-%{pypi_name}
|
||||||
%{common_desc}
|
%{common_desc}
|
||||||
|
|
||||||
|
%if 0%{?with_doc}
|
||||||
%package doc
|
%package doc
|
||||||
Summary: Documentation for OpenStack Aodh API Client
|
Summary: Documentation for OpenStack Aodh API Client
|
||||||
|
|
||||||
BuildRequires: python-sphinx
|
BuildRequires: python%{pyver}-sphinx
|
||||||
# FIXME: remove following line when a new release including https://review.openstack.org/#/c/476759/ is in u-c
|
BuildRequires: python%{pyver}-openstackdocstheme
|
||||||
BuildRequires: python-oslo-sphinx
|
BuildRequires: python%{pyver}-keystoneauth1
|
||||||
BuildRequires: python-openstackdocstheme
|
BuildRequires: python%{pyver}-oslo-utils
|
||||||
BuildRequires: python-keystoneauth1
|
BuildRequires: python%{pyver}-oslo-serialization
|
||||||
BuildRequires: python-oslo-utils
|
BuildRequires: python%{pyver}-cliff
|
||||||
BuildRequires: python-oslo-serialization
|
|
||||||
BuildRequires: python-cliff
|
|
||||||
|
|
||||||
|
|
||||||
%description doc
|
%description doc
|
||||||
@ -68,48 +79,15 @@ BuildRequires: python-cliff
|
|||||||
(aodh).
|
(aodh).
|
||||||
|
|
||||||
This package contains auto-generated documentation.
|
This package contains auto-generated documentation.
|
||||||
|
|
||||||
%package -n python2-%{pypi_name}-tests
|
|
||||||
Summary: Python API and CLI for OpenStack Aodh Tests
|
|
||||||
Requires: python2-%{pypi_name} = %{version}-%{release}
|
|
||||||
|
|
||||||
%description -n python2-%{pypi_name}-tests
|
|
||||||
%{common_desc}
|
|
||||||
|
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
|
||||||
%package -n python3-%{pypi_name}
|
|
||||||
Summary: Python API and CLI for OpenStack Aodh
|
|
||||||
|
|
||||||
%{?python_provide:%python_provide python3-%{pypi_name}}
|
|
||||||
|
|
||||||
BuildRequires: python3-setuptools
|
|
||||||
BuildRequires: python3-devel
|
|
||||||
BuildRequires: python3-pbr
|
|
||||||
|
|
||||||
Requires: python3-pbr
|
|
||||||
Requires: python3-cliff >= 1.14.0
|
|
||||||
Requires: python3-oslo-i18n >= 1.5.0
|
|
||||||
Requires: python3-oslo-serialization >= 1.4.0
|
|
||||||
Requires: python3-oslo-utils >= 2.0.0
|
|
||||||
Requires: python3-keystoneauth1 >= 1.0.0
|
|
||||||
Requires: python3-six >= 1.9.0
|
|
||||||
Requires: python3-osc-lib >= 1.0.1
|
|
||||||
Requires: python3-osprofiler >= 1.4.0
|
|
||||||
Requires: python3-pyparsing
|
|
||||||
|
|
||||||
%description -n python3-%{pypi_name}
|
|
||||||
%{common_desc}
|
|
||||||
|
|
||||||
%package -n python3-%{pypi_name}-tests
|
|
||||||
Summary: Python API and CLI for OpenStack Aodh Tests
|
|
||||||
Requires: python3-%{pypi_name} = %{version}-%{release}
|
|
||||||
|
|
||||||
%description -n python3-%{pypi_name}-tests
|
|
||||||
%{common_desc}
|
|
||||||
|
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
%package -n python%{pyver}-%{pypi_name}-tests
|
||||||
|
Summary: Python API and CLI for OpenStack Aodh Tests
|
||||||
|
Requires: python%{pyver}-%{pypi_name} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description -n python%{pyver}-%{pypi_name}-tests
|
||||||
|
%{common_desc}
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n %{pypi_name}-%{upstream_version} -S git
|
%autosetup -n %{pypi_name}-%{upstream_version} -S git
|
||||||
|
|
||||||
@ -118,70 +96,44 @@ rm -f {,test-}requirements.txt
|
|||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
export PBR_VERSION=%{version}
|
%{pyver_build}
|
||||||
%py2_build
|
%{pyver_build_wheel}
|
||||||
%py2_build_wheel
|
|
||||||
%if 0%{?with_python3}
|
|
||||||
%py3_build
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
export PBR_VERSION=%{version}
|
%{pyver_install}
|
||||||
%if 0%{?with_python3}
|
|
||||||
%py3_install
|
|
||||||
mv %{buildroot}%{_bindir}/aodh %{buildroot}%{_bindir}/aodh-%{python3_version}
|
|
||||||
ln -s ./aodh-%{python3_version} %{buildroot}%{_bindir}/aodh-3
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%py2_install
|
|
||||||
mv %{buildroot}%{_bindir}/aodh %{buildroot}%{_bindir}/aodh-%{python2_version}
|
|
||||||
ln -s ./aodh-%{python2_version} %{buildroot}%{_bindir}/aodh-2
|
|
||||||
|
|
||||||
ln -s ./aodh-2 %{buildroot}%{_bindir}/aodh
|
|
||||||
|
|
||||||
export PYTHONPATH=.
|
|
||||||
sphinx-build -b html doc/source doc/build/html
|
|
||||||
# remove the sphinx-build leftovers
|
|
||||||
rm -rf doc/build/html/.{doctrees,buildinfo}
|
|
||||||
|
|
||||||
# STX: stage wheels
|
# STX: stage wheels
|
||||||
mkdir -p $RPM_BUILD_ROOT/wheels
|
mkdir -p $RPM_BUILD_ROOT/wheels
|
||||||
install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/
|
install -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/
|
||||||
|
|
||||||
|
# Create a versioned binary for backwards compatibility until everything is pure py3
|
||||||
|
ln -s aodh %{buildroot}%{_bindir}/aodh-%{pyver}
|
||||||
|
|
||||||
%files -n python2-%{pypi_name}
|
%if 0%{?with_doc}
|
||||||
%doc README.rst
|
export PYTHONPATH=.
|
||||||
%license LICENSE
|
sphinx-build-%{pyver} -b html doc/source doc/build/html
|
||||||
%{python2_sitelib}/aodhclient
|
# remove the sphinx-build-%{pyver} leftovers
|
||||||
%{python2_sitelib}/*.egg-info
|
rm -rf doc/build/html/.{doctrees,buildinfo}
|
||||||
%{_bindir}/aodh
|
|
||||||
%{_bindir}/aodh-2
|
|
||||||
%{_bindir}/aodh-%{python2_version}
|
|
||||||
%exclude %{python2_sitelib}/aodhclient/tests
|
|
||||||
|
|
||||||
%files -n python2-%{pypi_name}-tests
|
|
||||||
%license LICENSE
|
|
||||||
%{python2_sitelib}/aodhclient/tests
|
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
|
||||||
%files -n python3-%{pypi_name}
|
|
||||||
%license LICENSE
|
|
||||||
%doc README.rst
|
|
||||||
%{python3_sitelib}/%{pypi_name}
|
|
||||||
%{python3_sitelib}/*.egg-info
|
|
||||||
%{_bindir}/aodh-3
|
|
||||||
%{_bindir}/aodh-%{python3_version}
|
|
||||||
%exclude %{python3_sitelib}/aodhclient/tests
|
|
||||||
|
|
||||||
%files -n python3-%{pypi_name}-tests
|
|
||||||
%license LICENSE
|
|
||||||
%{python3_sitelib}/aodhclient/tests
|
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
%files -n python%{pyver}-%{pypi_name}
|
||||||
|
%doc README.rst
|
||||||
|
%license LICENSE
|
||||||
|
%{pyver_sitelib}/aodhclient
|
||||||
|
%{pyver_sitelib}/*.egg-info
|
||||||
|
%{_bindir}/aodh
|
||||||
|
%{_bindir}/aodh-%{pyver}
|
||||||
|
%exclude %{pyver_sitelib}/aodhclient/tests
|
||||||
|
|
||||||
|
%files -n python%{pyver}-%{pypi_name}-tests
|
||||||
|
%license LICENSE
|
||||||
|
%{pyver_sitelib}/aodhclient/tests
|
||||||
|
|
||||||
|
%if 0%{?with_doc}
|
||||||
%files doc
|
%files doc
|
||||||
%doc doc/build/html
|
%doc doc/build/html
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
|
%endif
|
||||||
|
|
||||||
%package wheels
|
%package wheels
|
||||||
Summary: %{name} wheels
|
Summary: %{name} wheels
|
||||||
@ -193,6 +145,6 @@ Contains python wheels for %{name}
|
|||||||
/wheels/*
|
/wheels/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Thu Aug 09 2018 RDO <dev@lists.rdoproject.org> 1.1.1-1
|
* Mon Sep 23 2019 RDO <dev@lists.rdoproject.org> 1.3.0-1
|
||||||
- Update to 1.1.1
|
- Update to 1.3.0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user