From 530d9a51db42f2d621f4a00ab51641493dfddc58 Mon Sep 17 00:00:00 2001 From: Haikel Guemar Date: Aug 17 2016 10:20:51 +0000 Subject: Add python3 subpackage Use pypi.io for Source URL Change-Id: I2b46dc7c8f6ac0295bb2f4bbc83463c52c29d26e (cherry picked from commit 6c3ff28e05f659bedcdf14d86db9d6e07bf40e05) (cherry picked from commit 03e62b61ea94bd088fa3f6d08b23d4e8b6c58b61) --- diff --git a/python-cinderclient.spec b/python-cinderclient.spec index f29a4d1..5234ab6 100644 --- a/python-cinderclient.spec +++ b/python-cinderclient.spec @@ -1,4 +1,10 @@ %{!?upstream_version: %global upstream_version %{version}%{?milestone}} + +%global sname cinderclient +%if 0%{?fedora} +%global with_python3 1 +%endif + Name: python-cinderclient Version: 1.6.0 Release: 2%{?dist} @@ -6,11 +12,20 @@ Summary: Python API and CLI for OpenStack Cinder License: ASL 2.0 URL: http://github.com/openstack/python-cinderclient -Source0: http://pypi.python.org/packages/source/p/%{name}/%{name}-%{version}%{?milestone}.tar.gz +Source0: https://pypi.io/packages/source/p/%{name}/%{name}-%{version}.tar.gz BuildArch: noarch BuildRequires: git + +%description +Client library (cinderclient python module) and command line utility +(cinder) for interacting with OpenStack Cinder (Block Storage) API. + +%package -n python2-%{sname} +Summary: Python API and CLI for OpenStack Cinder +%{?python_provide:%python_provide python2-%{sname}} + BuildRequires: python2-devel BuildRequires: python-setuptools BuildRequires: python-pbr @@ -25,11 +40,36 @@ Requires: python-setuptools Requires: python-simplejson Requires: python-six -%description +%description -n python2-%{sname} Client library (cinderclient python module) and command line utility (cinder) for interacting with OpenStack Cinder (Block Storage) API. +%if 0%{?with_python3} +%package -n python3-%{sname} +Summary: Python API and CLI for OpenStack Cinder +%{?python_provide:%python_provide python3-%{sname}} + +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pbr +BuildRequires: python3-d2to1 + +Requires: python3-babel +Requires: python3-keystoneclient +Requires: python3-pbr +Requires: python3-prettytable +Requires: python3-requests +Requires: python3-setuptools +Requires: python3-simplejson +Requires: python3-six + +%description -n python3-%{sname} +Client library (cinderclient python module) and command line utility +(cinder) for interacting with OpenStack Cinder (Block Storage) API. +%endif + + %package doc Summary: Documentation for OpenStack Cinder API Client Group: Documentation @@ -55,33 +95,56 @@ rm -rf python_cinderclient.egg-info 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} +export PYTHONPATH="$( pwd ):$PYTHONPATH" +sphinx-build -b html doc/source html +sphinx-build -b man doc/source man -install -p -D -m 644 tools/cinder.bash_completion %{buildroot}%{_sysconfdir}/bash_completion.d/cinder.bash_completion +# Fix hidden-file-or-dir warnings +rm -fr html/.doctrees html/.buildinfo +%install +%if 0%{?with_python3} +%py3_install +mv %{buildroot}%{_bindir}/cinder %{buildroot}%{_bindir}/cinder-%{python3_version} +ln -s ./cinder-%{python3_version} %{buildroot}%{_bindir}/cinder-3 +# Delete tests +rm -fr %{buildroot}%{python3_sitelib}/cinderclient/tests +%endif + +%py2_install +mv %{buildroot}%{_bindir}/cinder %{buildroot}%{_bindir}/cinder-%{python2_version} +ln -s ./cinder-%{python2_version} %{buildroot}%{_bindir}/cinder-2 # Delete tests rm -fr %{buildroot}%{python2_sitelib}/cinderclient/tests -export PYTHONPATH="$( pwd ):$PYTHONPATH" -sphinx-build -b html doc/source html -sphinx-build -b man doc/source man +ln -s ./cinder-2 %{buildroot}%{_bindir}/cinder -install -p -D -m 644 man/cinder.1 %{buildroot}%{_mandir}/man1/cinder.1 +install -p -D -m 644 tools/cinder.bash_completion %{buildroot}%{_sysconfdir}/bash_completion.d/cinder.bash_completion -# Fix hidden-file-or-dir warnings -rm -fr html/.doctrees html/.buildinfo +install -p -D -m 644 man/cinder.1 %{buildroot}%{_mandir}/man1/cinder.1 -%files +%files -n python2-%{sname} %doc LICENSE README.rst %{_bindir}/cinder +%{_bindir}/cinder-2* %{python2_sitelib}/cinderclient %{python2_sitelib}/*.egg-info %{_sysconfdir}/bash_completion.d/cinder.bash_completion %{_mandir}/man1/cinder.1* +%if 0%{?with_python3} +%files -n python3-%{sname} +%doc LICENSE README.rst +%{_bindir}/cinder-3* +%{python3_sitelib}/cinderclient +%{python3_sitelib}/*.egg-info +%endif + %files doc %doc html