Package: cdbs Version: 0.4.90 Severity: wishlist
Attached patch adds new classes (based on the ones for Python 2) that add support for Python 3. We want to keep Python 2 and Python 3 stack separate hence different namespace.
diff -ruN cdbs-0.4.89/1/class/python3-distutils.mk.in cdbs-0.4.90_python3/1/class/python3-distutils.mk.in --- cdbs-0.4.89/1/class/python3-distutils.mk.in 1970-01-01 01:00:00.000000000 +0100 +++ cdbs-0.4.90_python3/1/class/python3-distutils.mk.in 2010-11-21 01:02:57.604769000 +0100 @@ -0,0 +1,96 @@ +# -*- mode: makefile; coding: utf-8 -*- +# Copyright © 2003 Colin Walters <walt...@debian.org> +# Copyright © 2006 Marc Dequènes (Duck) <d...@duckcorp.org> +# Copyright © 2003,2006-2010 Jonas Smedegaard <d...@jones.dk> +# Description: manage Python modules using the 'distutils' build system +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +#PATH_RULES# + +ifndef _cdbs_class_python3_distutils +_cdbs_class_python3_distutils = 1 + +include $(_cdbs_class_path)/python3-module.mk$(_cdbs_makefile_suffix) + +DEB_PYTHON3_SETUP_CMD ?= setup.py +DEB_PYTHON3_CLEAN_ARGS ?= -a +DEB_PYTHON3_BUILD_ARGS_ALL ?= --build-base="$(CURDIR)/$(DEB_BUILDDIR)/build" +DEB_PYTHON3_BUILD_ARGS ?= --executable=/usr/bin/python3 +DEB_PYTHON3_INSTALL_ARGS_ALL ?= --install-layout=deb +#DEB_PYTHON3_INSTALL_ARGS + +# Python-related dependencies according to Python policy, appendix A +CDBS_BUILD_DEPENDS_class_python3-distutils ?= $(if $(cdbs_python3_arch_packages),python3-all-dev,python3-dev $(cdbs_python3_nondefault_version:%=, python%-dev)) +CDBS_BUILD_DEPENDS += , $(CDBS_BUILD_DEPENDS_class_python3-distutils) + + +pre-build:: + mkdir -p debian/python3-module-stampdir + +$(patsubst %,build/%,$(cdbs_python3_indep_packages) $(cdbs_python3_arch_packages)) :: build/% : debian/python3-module-stampdir/% + +# build stage +$(patsubst %,debian/python3-module-stampdir/%,$(cdbs_python3_indep_packages)) :: debian/python3-module-stampdir/%: + cd $(DEB_SRCDIR) && python$(cdbs_python3_nondefault_version) $(DEB_PYTHON3_SETUP_CMD) build $(DEB_PYTHON3_BUILD_ARGS_ALL) + touch $@ + +$(patsubst %,debian/python3-module-stampdir/%,$(cdbs_python3_arch_packages)) :: debian/python3-module-stampdir/%: + set -e; for buildver in $(cdbs_python3_build_versions); do \ + cd $(CURDIR) && cd $(DEB_SRCDIR) && \ + python$$buildver $(DEB_PYTHON3_SETUP_CMD) build $(DEB_PYTHON3_BUILD_ARGS_ALL) $(DEB_PYTHON3_BUILD_ARGS); \ + done + touch $@ + + +# install stage +$(patsubst %,install/%,$(cdbs_python3_indep_packages)) :: install/%: + cd $(DEB_SRCDIR) && \ + python$(cdbs_python3_nondefault_version) $(DEB_PYTHON3_SETUP_CMD) install --root=$(cdbs_python3_destdir) $(DEB_PYTHON3_INSTALL_ARGS_ALL) + +$(patsubst %,install/%,$(cdbs_python3_arch_packages)) :: install/%: + set -e; for buildver in $(cdbs_python3_build_versions); do \ + cd $(CURDIR) && cd $(DEB_SRCDIR) && \ + python$$buildver $(DEB_PYTHON3_SETUP_CMD) install --root=$(cdbs_python3_destdir) $(DEB_PYTHON3_INSTALL_ARGS_ALL) $(DEB_PYTHON3_INSTALL_ARGS); \ + done + +# clean stage +clean:: $(patsubst %,python3-module-clean/%,$(cdbs_python3_indep_packages) $(cdbs_python3_arch_packages)) + +$(patsubst %,python3-module-clean/%,$(cdbs_python3_indep_packages)) :: python3-module-clean/%: + -cd $(DEB_SRCDIR) && python$(cdbs_python3_nondefault_version) $(DEB_PYTHON3_SETUP_CMD) clean $(DEB_PYTHON3_CLEAN_ARGS) + +$(patsubst %,python3-module-clean/%,$(cdbs_python3_arch_packages)) :: python3-module-clean/%: + -for buildver in $(cdbs_python3_build_versions); do \ + cd $(CURDIR) && cd $(DEB_SRCDIR) && \ + python$$buildver $(DEB_PYTHON3_SETUP_CMD) clean $(DEB_PYTHON3_CLEAN_ARGS); \ + done + +# cleanup stamp dir +# (dh_clean choke on dirs named stamp, so need to happen before clean::) +clean:: clean-python3-distutils +clean-python3-distutils:: + rm -rf debian/python3-module-stampdir + +# Calling setup.py clean may create .pyc files and __pycache__ direcotries, so +# we need a final cleanup pass here. +# Also clean up .egg-info files generated by setuptools +clean:: + find $(CURDIR) -name '*.py[co]' -delete + find $(CURDIR) -name __pycache__ -type d -empty -delete + find $(CURDIR) -prune -name '*.egg-info' -exec rm -rf '{}' ';' + +.PHONY: $(patsubst %,debian/python3-module-stampdir/%,$(cdbs_python3_indep_packages) $(cdbs_python3_arch_packages)) +.PHONY: $(patsubst %,python3-module-clean/%,$(cdbs_python3_indep_packages) $(cdbs_python3_arch_packages)) +endif diff -ruN cdbs-0.4.89/1/class/python3-module.mk.in cdbs-0.4.90_python3/1/class/python3-module.mk.in --- cdbs-0.4.89/1/class/python3-module.mk.in 1970-01-01 01:00:00.000000000 +0100 +++ cdbs-0.4.90_python3/1/class/python3-module.mk.in 2010-11-14 16:23:56.000000000 +0100 @@ -0,0 +1,33 @@ +# -*- mode: makefile; coding: utf-8 -*- +# Copyright © 2003 Colin Walters <walt...@debian.org> +# Copyright © 2006 Marc Dequènes (Duck) <d...@duckcorp.org> +# Copyright © 2003,2006-2010 Jonas Smedegaard <d...@jones.dk> +# Description: Rules common to Python module packaging +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +#PATH_RULES# + +ifndef _cdbs_class_python3_module +_cdbs_class_python3_module = 1 + +include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix) +include $(_cdbs_class_path)/python3-vars.mk$(_cdbs_makefile_suffix) + +# Optionally use debhelper (if not then these rules are simply ignored) +$(patsubst %,binary-post-install/%,$(DEB_PACKAGES)) :: binary-post-install/%: binary-install-python3/% +$(patsubst %,binary-install-python3/%,$(DEB_PACKAGES)) :: binary-install-python3/%: binary-install/% + dh_python3 -p$(cdbs_curpkg) $(DEB_PYTHON3_PRIVATE_MODULES_DIRS) $(DEB_PYTHON3_PRIVATE_MODULES_DIRS_$(cdbs_curpkg)) + +endif diff -ruN cdbs-0.4.89/1/class/python3-vars.mk.in cdbs-0.4.90_python3/1/class/python3-vars.mk.in --- cdbs-0.4.89/1/class/python3-vars.mk.in 1970-01-01 01:00:00.000000000 +0100 +++ cdbs-0.4.90_python3/1/class/python3-vars.mk.in 2010-11-20 23:47:23.984520000 +0100 @@ -0,0 +1,43 @@ +# -*- mode: makefile; coding: utf-8 -*- +# Copyright © 2003 Colin Walters <walt...@debian.org> +# Copyright © 2006 Marc Dequènes (Duck) <d...@duckcorp.org> +# Copyright © 2003,2006-2009 Jonas Smedegaard <d...@jones.dk> +# Description: Common variables for Python packages +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +#PATH_RULES# + +ifndef _cdbs_class_python3_vars +_cdbs_class_python3_vars = 1 + +include $(_cdbs_rules_path)/buildvars.mk$(_cdbs_makefile_suffix) +include $(_cdbs_class_path)/langcore.mk$(_cdbs_makefile_suffix) + +cdbs_python3_packages = $(or $(DEB_PYTHON3_MODULE_PACKAGES),$(firstword $(filter-out %-doc %-dev %-common python-%, $(DEB_PACKAGES)))) +cdbs_python3_arch_packages = $(filter $(cdbs_python3_packages), $(DEB_ARCH_PACKAGES)) +cdbs_python3_indep_packages = $(filter $(cdbs_python3_packages), $(DEB_INDEP_PACKAGES)) + +cdbs_python3_destdir = $(or $(DEB_PYTHON3_DESTDIR),$(DEB_DESTDIR)) + +# Calculate cdbs_python3_build_versions +cdbs_python3_current_version := $(shell py3versions -vd) +cdbs_python3_supported_versions := $(shell py3versions -vr) +cdbs_python3_first_supported_version = $(firstword $(strip $(sort $(cdbs_python3_supported_versions)))) +# Non-default Python version used (only valid for arch-indendent builds) +# arch(+indep): 3; indep: 3 if current is supported, else first supported +cdbs_python3_nondefault_version = $(if $(cdbs_python3_arch_packages),3,$(if $(filter $(cdbs_python3_current_version),$(cdbs_python3_supported_versions)),3,$(cdbs_python3_first_supported_version))) +cdbs_python3_build_versions = $(or $(if $(cdbs_python3_arch_packages),$(cdbs_python3_supported_versions))) + +endif diff -ruN cdbs-0.4.89/debian/changelog cdbs-0.4.90_python3/debian/changelog --- cdbs-0.4.89/debian/changelog 2010-09-16 11:11:03.000000000 +0200 +++ cdbs-0.4.90_python3/debian/changelog 2010-11-23 20:43:40.326843676 +0100 @@ -1,3 +1,11 @@ +cdbs (0.4.90) UNRELEASED; urgency=low + + * Add python3-distutils.mk and python3-module.mk to support Python 3; + add tests/distutils-10.sh and tests/distutils-10.sh, + build depend on python3-all-dev (for tests and dh_python3), + + -- Piotr Ożarowski <pi...@debian.org> Sat, 20 Nov 2010 22:04:42 +0100 + cdbs (0.4.89) unstable; urgency=low * Stop conflicting against ancient/bogus build-common. diff -ruN cdbs-0.4.89/Makefile.am cdbs-0.4.90_python3/Makefile.am --- cdbs-0.4.89/Makefile.am 2010-05-22 22:52:01.000000000 +0200 +++ cdbs-0.4.90_python3/Makefile.am 2010-11-15 18:35:29.000000000 +0100 @@ -60,6 +60,9 @@ 1/class/python-module.mk \ 1/class/python-distutils.mk \ 1/class/python-sugar.mk \ + 1/class/python3-module.mk \ + 1/class/python3-vars.mk \ + 1/class/python3-distutils.mk \ 1/class/qmake.mk \ 1/class/scons-vars.mk \ 1/class/scons.mk \ diff -ruN cdbs-0.4.89/Makefile.in cdbs-0.4.90_python3/Makefile.in --- cdbs-0.4.89/Makefile.in 2010-05-22 22:52:01.000000000 +0200 +++ cdbs-0.4.90_python3/Makefile.in 2010-11-15 18:39:59.000000000 +0100 @@ -216,6 +216,9 @@ 1/class/python-module.mk \ 1/class/python-distutils.mk \ 1/class/python-sugar.mk \ + 1/class/python3-module.mk \ + 1/class/python3-vars.mk \ + 1/class/python3-distutils.mk \ 1/class/qmake.mk \ 1/class/scons-vars.mk \ 1/class/scons.mk \ diff -ruN cdbs-0.4.89/test/distutils/src/foo.py cdbs-0.4.90_python3/test/distutils/src/foo.py --- cdbs-0.4.89/test/distutils/src/foo.py 2010-05-22 22:52:01.000000000 +0200 +++ cdbs-0.4.90_python3/test/distutils/src/foo.py 2010-11-20 23:48:08.508576000 +0100 @@ -4,5 +4,5 @@ self.id = 555 def output(self): - print self.name - print self.id + print(self.name) + print(self.id) diff -ruN cdbs-0.4.89/test/distutils-10.sh cdbs-0.4.90_python3/test/distutils-10.sh --- cdbs-0.4.89/test/distutils-10.sh 1970-01-01 01:00:00.000000000 +0100 +++ cdbs-0.4.90_python3/test/distutils-10.sh 2010-11-21 01:17:31.816771000 +0100 @@ -0,0 +1,71 @@ +#!/bin/bash +# -*- mode: sh; coding: utf-8 -*- +# Copyright © 2006 Peter Eisentraut <pet...@debian.org> +# Copyright © 2009 Jonas Smedegaard <d...@jones.dk> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# Test distutils arch package + extra package w/ dh_python{2,3} + +. testsuite_functions + +options $@ +setup_workdir + +cat <<EOF >$WORKDIR/debian/rules +#!/usr/bin/make -f +DEB_TAR_SRCDIR=distutils-test-0.1 +DEB_PYTHON_SYSTEM = python2 +DEB_PYTHON_MODULE_PACKAGES = python-cdbs-testsuite +DEB_PYTHON3_MODULE_PACKAGES = python3-cdbs-testsuite +include debian/testsuite.mk +include \$(_cdbs_package_root_dir)/1/rules/debhelper.mk.in +include \$(_cdbs_package_root_dir)/1/class/python-distutils.mk.in +include \$(_cdbs_package_root_dir)/1/class/python3-distutils.mk.in +DEB_PYTHON_DESTDIR = \$(CURDIR)/debian/\$(cdbs_curpkg) +DEB_PYTHON3_DESTDIR = \$(CURDIR)/debian/\$(cdbs_curpkg) +EOF +chmod +x $WORKDIR/debian/rules + +cat >>$WORKDIR/debian/control <<EOF + +Package: python-cdbs-testsuite +Architecture: any +Description: common build system test suite + This package is part of the testsuite for the CDBS build system. If you've + managed to install this, something has gone horribly wrong. + +Package: python3-cdbs-testsuite +Architecture: any +Description: common build system test suite + This package is part of the testsuite for the CDBS build system. If you've + managed to install this, something has gone horribly wrong. +EOF + +cp -R distutils/* $WORKDIR +sed -i 's/^#EXT#/ /g' $WORKDIR/setup.py +touch $WORKDIR/foo.c + +build_package + +dpkg -c $WORKDIR/../python-cdbs-testsuite_0.1_*.deb \ + | grep -q '/usr/share/pyshared/testing/foo.py' \ + || return_fail + +dpkg -c $WORKDIR/../python3-cdbs-testsuite_0.1_*.deb \ + | grep -q '/usr/lib/python3/dist-packages/testing/foo.py' \ + || return_fail + +clean_workdir +return_pass diff -ruN cdbs-0.4.89/test/distutils-11.sh cdbs-0.4.90_python3/test/distutils-11.sh --- cdbs-0.4.89/test/distutils-11.sh 1970-01-01 01:00:00.000000000 +0100 +++ cdbs-0.4.90_python3/test/distutils-11.sh 2010-11-21 00:09:57.420520000 +0100 @@ -0,0 +1,48 @@ +#!/bin/bash +# -*- mode: sh; coding: utf-8 -*- +# Copyright © 2006 Peter Eisentraut <pet...@debian.org> +# Copyright © 2009 Jonas Smedegaard <d...@jones.dk> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# Test distutils indep package w/ dh_python3 + +. testsuite_functions + +options $@ +setup_workdir + +cat <<EOF >$WORKDIR/debian/rules +#!/usr/bin/make -f +include debian/testsuite.mk +include \$(_cdbs_package_root_dir)/1/rules/debhelper.mk.in +include \$(_cdbs_package_root_dir)/1/class/python3-distutils.mk.in +EOF +chmod +x $WORKDIR/debian/rules + +sed -i \ + -e 's/Package: cdbs-testsuite/Package: python3-cdbs-testsuite/' \ + -e 's/Architecture: any/Architecture: all/' \ + $WORKDIR/debian/control + +cp -R distutils/* $WORKDIR + +build_package + +dpkg -c $WORKDIR/../python3-cdbs-testsuite_0.1_*.deb \ + | grep -q '/usr/lib/python3/dist-packages/testing/foo.py' \ + || return_fail + +clean_workdir +return_pass diff -ruN cdbs-0.4.89/test/Makefile.am cdbs-0.4.90_python3/test/Makefile.am --- cdbs-0.4.89/test/Makefile.am 2010-05-22 22:52:01.000000000 +0200 +++ cdbs-0.4.90_python3/test/Makefile.am 2010-11-23 20:40:18.683341820 +0100 @@ -46,6 +46,8 @@ distutils-6.sh \ distutils-7.sh \ distutils-8.sh \ + distutils-10.sh \ + distutils-11.sh \ ant-1.sh TARBALLS = tarballs/autotools-test-0.1.tar.gz \ diff -ruN cdbs-0.4.89/test/Makefile.in cdbs-0.4.90_python3/test/Makefile.in --- cdbs-0.4.89/test/Makefile.in 2010-05-22 22:52:01.000000000 +0200 +++ cdbs-0.4.90_python3/test/Makefile.in 2010-11-23 20:40:08.630844994 +0100 @@ -148,6 +148,8 @@ distutils-6.sh \ distutils-7.sh \ distutils-8.sh \ + distutils-10.sh \ + distutils-11.sh \ ant-1.sh TARBALLS = tarballs/autotools-test-0.1.tar.gz \