From d6883a4b0c211d974b1bd2b9f673bcb5636171eb Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Thu, 18 Jun 2015 08:00:02 +0000 Subject: [PATCH] * Added Python3 support. * Swiched to using testr directly when running tests. --- debian/changelog | 5 +++ debian/control | 51 +++++++++++++++++++++++++--- debian/gbp.conf | 2 +- debian/python-cinderclient.postinst | 11 ++++++ debian/python-cinderclient.postrm | 11 ++++++ debian/python-cinderclient.prerm | 11 ++++++ debian/python3-cinderclient.postinst | 11 ++++++ debian/python3-cinderclient.postrm | 11 ++++++ debian/python3-cinderclient.prerm | 11 ++++++ debian/rules | 42 ++++++++++++++++------- 10 files changed, 148 insertions(+), 18 deletions(-) create mode 100644 debian/python-cinderclient.postinst create mode 100644 debian/python-cinderclient.postrm create mode 100644 debian/python-cinderclient.prerm create mode 100644 debian/python3-cinderclient.postinst create mode 100644 debian/python3-cinderclient.postrm create mode 100644 debian/python3-cinderclient.prerm diff --git a/debian/changelog b/debian/changelog index 49527ee..20e7ea9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ python-cinderclient (1:1.2.2-1) UNRELEASED; urgency=medium + [ Corey Bryant ] * New upstream release. - d/control: Align requirements with upstream. - d/gbp.conf: Update gbp configuration for liberty branch. @@ -7,6 +8,10 @@ python-cinderclient (1:1.2.2-1) UNRELEASED; urgency=medium - d/tests/*: Add DEP 8 tests from Ubuntu. - d/rules: Fail the build if tests fail. + [ Thomas Goirand ] + * Added Python3 support. + * Swiched to using testr directly when running tests. + -- Corey Bryant Mon, 08 Jun 2015 10:40:39 -0400 python-cinderclient (1:1.1.1-2) unstable; urgency=medium diff --git a/debian/control b/debian/control index ae2b196..ee19c1f 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: python-cinderclient Section: python Priority: optional Maintainer: PKG OpenStack -Uploaders: Thomas Goirand +Uploaders: Thomas Goirand , Build-Depends: debhelper (>= 9), dh-python, openstack-pkg-tools, @@ -10,6 +10,9 @@ Build-Depends: debhelper (>= 9), python-pbr, python-setuptools, python-sphinx, + python3-all, + python3-pbr, + python3-setuptools, Build-Depends-Indep: python-babel, python-coverage, python-fixtures, @@ -22,9 +25,21 @@ Build-Depends-Indep: python-babel, python-requests-mock (>= 0.6.0), python-simplejson, python-six (>= 1.9.0), - python-testtools, python-tempest-lib (>= 0.5.0), + python-testtools, python-unittest2, + python3-babel, + python3-fixtures, + python3-keystoneclient (>= 1:1.6.0), + python3-mock, + python3-prettytable, + python3-requests (>= 2.5.2), + python3-requests-mock (>= 0.6.0), + python3-simplejson, + python3-six (>= 1.9.0), + python3-subunit, + python3-tempest-lib (>= 0.5.0), + python3-testtools, subunit, testrepository, Standards-Version: 3.9.6 @@ -35,7 +50,6 @@ XS-Testsuite: autopkgtest Package: python-cinderclient Architecture: all -Pre-Depends: dpkg (>= 1.15.6~) Depends: python-babel, python-keystoneclient (>= 1:1.6.0), python-pbr, @@ -45,8 +59,8 @@ Depends: python-babel, python-six (>= 1.9.0), ${misc:Depends}, ${python:Depends}, -Provides: ${python:Provides} -Description: Python bindings to the OpenStack Volume API +Provides: ${python:Provides}, +Description: Python bindings to the OpenStack Volume API - Python 2.x Cinder is a block storage as service system for the Openstack cloud computing software suite. It is a direct replacement for nova-volume as a separate project. Cinder users LVM partitions of your volume servers in order to @@ -56,3 +70,30 @@ Description: Python bindings to the OpenStack Volume API This package contains the a client for the OpenStack Volume API. There's a Python API (the "cinderclient" module), and a command-line script ("cinder"). Each implements 100% of the OpenStack Volume API. + . + This package provides the Python 2.x module. + +Package: python3-cinderclient +Architecture: all +Depends: python3-babel, + python3-keystoneclient (>= 1:1.6.0), + python3-pbr, + python3-prettytable, + python3-requests (>= 2.5.2), + python3-simplejson, + python3-six (>= 1.9.0), + ${misc:Depends}, + ${python3:Depends}, +Provides: ${python:Provides}, +Description: Python bindings to the OpenStack Volume API - Python 3.x + Cinder is a block storage as service system for the Openstack cloud computing + software suite. It is a direct replacement for nova-volume as a separate + project. Cinder users LVM partitions of your volume servers in order to + provide iSCSI permanent block storage devices for your virtual machines + running on Nova. + . + This package contains the a client for the OpenStack Volume API. There's a + Python API (the "cinderclient" module), and a command-line script ("cinder"). + Each implements 100% of the OpenStack Volume API. + . + This package provides the Python 3.x module. diff --git a/debian/gbp.conf b/debian/gbp.conf index cadc09b..7de2153 100644 --- a/debian/gbp.conf +++ b/debian/gbp.conf @@ -4,6 +4,6 @@ debian-branch = debian/liberty upstream-tag = %(version)s compression = xz -[git-buildpackage] +[buildpackage] export-dir = ../build-area/ cleaner = true diff --git a/debian/python-cinderclient.postinst b/debian/python-cinderclient.postinst new file mode 100644 index 0000000..08a6ff8 --- /dev/null +++ b/debian/python-cinderclient.postinst @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +if [ "$1" = "configure" ] ; then + update-alternatives --install /usr/bin/cinder cinder /usr/bin/python2-cinder 300 +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/python-cinderclient.postrm b/debian/python-cinderclient.postrm new file mode 100644 index 0000000..f26bb6e --- /dev/null +++ b/debian/python-cinderclient.postrm @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +if [ "$1" = "remove" ] || [ "$1" = "disappear" ] ; then + update-alternatives --remove cinder /usr/bin/python2-cinder +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/python-cinderclient.prerm b/debian/python-cinderclient.prerm new file mode 100644 index 0000000..853db05 --- /dev/null +++ b/debian/python-cinderclient.prerm @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +if [ "$1" = "remove" ] ; then + update-alternatives --remove cinder /usr/bin/python2-cinder +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/python3-cinderclient.postinst b/debian/python3-cinderclient.postinst new file mode 100644 index 0000000..118d846 --- /dev/null +++ b/debian/python3-cinderclient.postinst @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +if [ "$1" = "configure" ] ; then + update-alternatives --install /usr/bin/cinder cinder /usr/bin/python3-cinder 200 +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/python3-cinderclient.postrm b/debian/python3-cinderclient.postrm new file mode 100644 index 0000000..c3be2a6 --- /dev/null +++ b/debian/python3-cinderclient.postrm @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +if [ "$1" = "remove" ] || [ "$1" = "disappear" ] ; then + update-alternatives --remove cinder /usr/bin/python3-cinder +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/python3-cinderclient.prerm b/debian/python3-cinderclient.prerm new file mode 100644 index 0000000..beaa79a --- /dev/null +++ b/debian/python3-cinderclient.prerm @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +if [ "$1" = "remove" ] ; then + update-alternatives --remove cinder /usr/bin/python3-cinder +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/rules b/debian/rules index 67ea381..71b4514 100755 --- a/debian/rules +++ b/debian/rules @@ -1,33 +1,51 @@ #!/usr/bin/make -f # -*- makefile -*- -#export DH_VERBOSE=1 +PYTHONS:=$(shell pyversions -vr) +PYTHON3S:=$(shell py3versions -vr) include /usr/share/openstack-pkg-tools/pkgos.make export OSLO_PACKAGE_VERSION=$(VERSION) +%: + dh $@ --with python2,python3 + override_dh_auto_clean: dh_auto_clean - rm -f cinderclient/versioninfo - rm -rf setuptools_git-*.egg rm -rf build -override_dh_auto_configure: - echo $(VERSION) > cinderclient/versioninfo - dh_auto_configure +override_dh_auto_install: + set -e ; for pyvers in $(PYTHONS); do \ + python$$pyvers setup.py install --install-layout=deb \ + --root $(CURDIR)/debian/python-cinderclient; \ + done + set -e ; for pyvers in $(PYTHON3S); do \ + python$$pyvers setup.py install --install-layout=deb \ + --root $(CURDIR)/debian/python3-cinderclient; \ + done + rm -f $(CURDIR)/debian/python*/usr/lib/python*/dist-packages/*.pth + mv $(CURDIR)/debian/python-cinderclient/usr/bin/cinder $(CURDIR)/debian/python-cinderclient/usr/bin/python2-cinder + mv $(CURDIR)/debian/python3-cinderclient/usr/bin/cinder $(CURDIR)/debian/python3-cinderclient/usr/bin/python3-cinder override_dh_install: dh_install install -D -m 0644 tools/cinder.bash_completion $(CURDIR)/debian/python-cinderclient/etc/bash_completion.d/cinder.bash_completion -%: - dh $@ --with python2 - -ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) override_dh_auto_test: - ./run_tests.sh -P -N - #python setup.py testr --slowest --testr-args='--subunit ' +ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) + @echo "===> Running tests" + set -e ; set -x ; for i in 2.7 $(PYTHON3S) ; do \ + PYMAJOR=`echo $$i | cut -d'.' -f1` ; \ + echo "===> Testing with python$$i (python$$PYMAJOR)" ; \ + rm -rf .testrepository ; \ + testr-python$$PYMAJOR init ; \ + TEMP_REZ=`mktemp -t` ; \ + PYTHONPATH=$(CURDIR) PYTHON=python$$i testr-python$$PYMAJOR run --subunit | tee $$TEMP_REZ | subunit2pyunit ; \ + cat $$TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats ; \ + rm -f $$TEMP_REZ ; \ + testr-python$$PYMAJOR slowest ; \ + done endif # Commands not to run