From 0a09127a44893f04c8eb26c358c6d404f39fa623 Mon Sep 17 00:00:00 2001 From: Chandan Kumar Date: Jul 26 2016 17:34:17 +0000 Subject: Added py2 and py3 subpackage Change-Id: Ie4fc0bf4415348167f1ec42b2b29f3b5573e9afe Co-Authored-By: Haïkel Guémar (cherry picked from commit 117af38c2edb5aa74a57c688630e6f144734f9f8) (cherry picked from commit 388ac5c9ab735f33e4b6a1c8e6ea7ab25fb0d850) --- diff --git a/python-novaclient.spec b/python-novaclient.spec index ca1c81c..002c275 100644 --- a/python-novaclient.spec +++ b/python-novaclient.spec @@ -1,31 +1,38 @@ %{!?upstream_version: %global upstream_version %{version}%{?milestone}} +%global sname novaclient + +%if 0%{?fedora} +%global with_python3 1 +%endif + Name: python-novaclient Epoch: 1 Version: 3.3.1 Release: 2%{?dist} Summary: Python API and CLI for OpenStack Nova - -Group: Development/Languages License: ASL 2.0 -URL: http://pypi.python.org/pypi/%{name} -Source0: http://pypi.python.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz +URL: https://launchpad.net/python-novaclient +Source0: https://pypi.io/packages/source/p/%{name}/%{name}-%{version}.tar.gz BuildArch: noarch + +%description +This is a client for the OpenStack Nova API. There's a Python API (the +novaclient module), and a command-line script (nova). Each implements 100% of +the OpenStack Nova API. + +%package -n python2-%{sname} +Summary: Python API and CLI for OpenStack Nova +%{?python_provide:%python_provide python2-novaclient} + BuildRequires: python2-devel -BuildRequires: python-d2to1 -BuildRequires: python-keystoneclient -BuildRequires: python-netifaces BuildRequires: python-pbr BuildRequires: python-setuptools -Requires: python-argparse Requires: python-babel Requires: python-iso8601 -Requires: python-keyring Requires: python-keystoneauth1 -Requires: python-keystoneclient -Requires: python-netifaces Requires: python-oslo-i18n Requires: python-oslo-serialization Requires: python-oslo-utils @@ -36,14 +43,41 @@ Requires: python-simplejson Requires: python-six Requires: python-setuptools -%description +%description -n python2-%{sname} This is a client for the OpenStack Nova API. There's a Python API (the novaclient module), and a command-line script (nova). Each implements 100% of the OpenStack Nova API. +%if 0%{?with_python3} +%package -n python3-%{sname} +Summary: Python API and CLI for OpenStack Nova +%{?python_provide:%python_provide python3-novaclient} + +BuildRequires: python3-devel +BuildRequires: python3-pbr +BuildRequires: python3-setuptools + +Requires: python3-babel +Requires: python3-iso8601 +Requires: python3-keystoneauth1 +Requires: python3-oslo-i18n +Requires: python3-oslo-serialization +Requires: python3-oslo-utils +Requires: python3-pbr +Requires: python3-prettytable +Requires: python3-requests +Requires: python3-simplejson +Requires: python3-six +Requires: python3-setuptools + +%description -n python3-%{sname} +This is a client for the OpenStack Nova API. There's a Python API (the +novaclient module), and a command-line script (nova). Each implements 100% of +the OpenStack Nova API. +%endif + %package doc Summary: Documentation for OpenStack Nova API Client -Group: Documentation BuildRequires: python-sphinx BuildRequires: python-oslo-sphinx @@ -58,24 +92,37 @@ This package contains auto-generated documentation. %prep %setup -q -n %{name}-%{upstream_version} -# Remove bundled egg-info -rm -rf python_novaclient.egg-info - # Let RPM handle the requirements rm -f {,test-}requirements.txt %build -%{__python2} setup.py build +%py2_build +%if 0%{?with_python3} +%py3_build +%endif %install -%{__python2} setup.py install -O1 --skip-build --root %{buildroot} +%if 0%{?with_python3} +%py3_install +mv %{buildroot}%{_bindir}/nova %{buildroot}%{_bindir}/nova-%{python3_version} +ln -s ./nova-%{python3_version} %{buildroot}%{_bindir}/nova-3 +# Delete tests +rm -fr %{buildroot}%{python3_sitelib}/novaclient/tests +%endif + +%py2_install +mv %{buildroot}%{_bindir}/nova %{buildroot}%{_bindir}/nova-%{python2_version} +ln -s ./nova-%{python2_version} %{buildroot}%{_bindir}/nova-2 + +ln -s ./nova-2 %{buildroot}%{_bindir}/nova mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d install -pm 644 tools/nova.bash_completion \ %{buildroot}%{_sysconfdir}/bash_completion.d/nova # Delete tests -rm -fr %{buildroot}%{python_sitelib}/novaclient/tests +rm -fr %{buildroot}%{python2_sitelib}/novaclient/tests + export PYTHONPATH="$( pwd ):$PYTHONPATH" sphinx-build -b html doc/source html sphinx-build -b man doc/source man @@ -85,17 +132,33 @@ install -p -D -m 644 man/nova.1 %{buildroot}%{_mandir}/man1/nova.1 # Fix hidden-file-or-dir warnings rm -fr html/.doctrees html/.buildinfo -%files +%files -n python2-%{sname} +%license LICENSE %doc README.rst -%doc LICENSE -%{_bindir}/nova -%{python2_sitelib}/novaclient +%{python2_sitelib}/%{sname} %{python2_sitelib}/*.egg-info %{_sysconfdir}/bash_completion.d %{_mandir}/man1/nova.1.gz +%{_bindir}/nova +%{_bindir}/nova-2 +%{_bindir}/nova-%{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 +%{_mandir}/man1/nova.1.gz +%{_bindir}/nova-3 +%{_bindir}/nova-%{python3_version} +%endif %files doc %doc html +%license LICENSE %changelog * Tue Jul 19 2016 Fedora Release Engineering - 1:3.3.1-2