[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[RFC] Python 3 support in CDBS



CDBS is not that popular among maintainers of Python related packages
(dh rules!) so I wrote python3-distutils.mk (based on
python-distutils.mk) for it hoping that dh lovers will now do their best
to support Python 3 better than CDBS does with attached patch.

I hope dh will win (again) so I'm sending my patch here, please try to
find bugs so that I can delay sending it to CDBS maintainers and give dh
guys more time. TIA

PS I also added "python2" to DEB_PYTHON_SYSTEM keywords (to
support dh_python2) and removed all pycompat stuff
-- 
Piotr Ożarowski                         Debian GNU/Linux Developer
www.ozarowski.pl          www.griffith.cc           www.debian.org
GPG Fingerprint: 1D2F A898 58DA AF62 1786 2DF7 AEF6 F1A2 A745 7645
diff -Nru cdbs-0.4.89/1/class/python3-distutils.mk.in cdbs-0.4.90/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/1/class/python3-distutils.mk.in	2010-11-21 01:02:57.000000000 +0100
@@ -0,0 +1,96 @@
+# -*- mode: makefile; coding: utf-8 -*-
+# Copyright © 2003 Colin Walters <walters@debian.org>
+# Copyright © 2006 Marc Dequènes (Duck) <Duck@DuckCorp.org>
+# Copyright © 2003,2006-2010 Jonas Smedegaard <dr@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 -Nru cdbs-0.4.89/1/class/python3-module.mk.in cdbs-0.4.90/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/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 <walters@debian.org>
+# Copyright © 2006 Marc Dequènes (Duck) <Duck@DuckCorp.org>
+# Copyright © 2003,2006-2010 Jonas Smedegaard <dr@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 -Nru cdbs-0.4.89/1/class/python3-vars.mk.in cdbs-0.4.90/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/1/class/python3-vars.mk.in	2010-11-20 23:47:23.000000000 +0100
@@ -0,0 +1,43 @@
+# -*- mode: makefile; coding: utf-8 -*-
+# Copyright © 2003 Colin Walters <walters@debian.org>
+# Copyright © 2006 Marc Dequènes (Duck) <Duck@DuckCorp.org>
+# Copyright © 2003,2006-2009 Jonas Smedegaard <dr@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 -Nru cdbs-0.4.89/1/class/python-module.mk.in cdbs-0.4.90/1/class/python-module.mk.in
--- cdbs-0.4.89/1/class/python-module.mk.in	2010-05-22 22:52:01.000000000 +0200
+++ cdbs-0.4.90/1/class/python-module.mk.in	2010-11-14 14:40:11.000000000 +0100
@@ -32,12 +32,13 @@
 CDBS_BUILD_DEPENDS_class_python-module_pycentral ?= python-central
 CDBS_BUILD_DEPENDS += $(if $(cdbs_python_pycentral),$(comma) $(CDBS_BUILD_DEPENDS_class_python-module_pycentral))
 
+# dh_python2 comes from python package
+CDBS_BUILD_DEPENDS_class_python-module_python2 ?= python
+CDBS_BUILD_DEPENDS += $(if $(cdbs_python_2),$(comma) $(CDBS_BUILD_DEPENDS_class_python-module_python2))
+
 # Optionally use debhelper (if not then these rules are simply ignored)
 $(patsubst %,binary-post-install/%,$(DEB_PACKAGES)) :: binary-post-install/%: binary-install-python/%
 $(patsubst %,binary-install-python/%,$(DEB_PACKAGES)) :: binary-install-python/%: binary-install/%
 	dh_$(cdbs_python_system) -p$(cdbs_curpkg) $(DEB_PYTHON_PRIVATE_MODULES_DIRS) $(DEB_PYTHON_PRIVATE_MODULES_DIRS_$(cdbs_curpkg))
 
-clean::
-	$(if $(cdbs_python_pycompat_explicit)$(cdbs_python_use_xs_field)$(cdbs_python_selected_pyversions),,echo "$(cdbs_python_pycompat)" >debian/pycompat)
-
 endif
diff -Nru cdbs-0.4.89/1/class/python-vars.mk.in cdbs-0.4.90/1/class/python-vars.mk.in
--- cdbs-0.4.89/1/class/python-vars.mk.in	2010-06-21 15:13:35.000000000 +0200
+++ cdbs-0.4.90/1/class/python-vars.mk.in	2010-11-15 18:26:55.000000000 +0100
@@ -33,7 +33,7 @@
 
 #DEB_PYTHON_DESTDIR = $(DEB_DESTDIR)
 
-cdbs_python_packages = $(or $(DEB_PYTHON_MODULE_PACKAGES),$(firstword $(filter-out %-doc %-dev %-common, $(DEB_PACKAGES))))
+cdbs_python_packages = $(or $(DEB_PYTHON_MODULE_PACKAGES),$(firstword $(filter-out %-doc %-dev %-common python3%, $(DEB_PACKAGES))))
 cdbs_python_arch_packages = $(filter $(cdbs_python_packages), $(DEB_ARCH_PACKAGES))
 cdbs_python_indep_packages = $(filter $(cdbs_python_packages), $(DEB_INDEP_PACKAGES))
 
@@ -44,17 +44,13 @@
 
 # check python system
 cdbs_python_use_xs_field := $(shell grep -q "^XS-Python-Version:" debian/control && echo yes)
-cdbs_python_pycompat_explicit := $(shell if [ -e debian/pycompat ]; then cat debian/pycompat; fi)
 cdbs_python_selected_pyversions := $(shell if [ -e debian/pyversions ]; then cat debian/pyversions; fi)
 
 # TODO: expand recursively (drop colon) when no longer used for rules expansion
 cdbs_python_pysupport := $(filter pysupport,$(DEB_PYTHON_SYSTEM))
 cdbs_python_pycentral := $(filter pycentral,$(DEB_PYTHON_SYSTEM))
-cdbs_python_system = $(or $(cdbs_python_pysupport),$(cdbs_python_pycentral),$(error unsupported Python system: $(DEB_PYTHON_SYSTEM) (select either pysupport or pycentral)))
-
-cdbs_python_pycompat_default_pysupport = 2
-cdbs_python_pycompat_default_pycentral = 2
-cdbs_python_pycompat = $(or $(cdbs_python_pycompat_explicit),$(cdbs_python_pycompat_default_$(cdbs_python_system)))
+cdbs_python_2 := $(filter python2,$(DEB_PYTHON_SYSTEM))
+cdbs_python_system = $(or $(cdbs_python_2),$(cdbs_python_pysupport),$(cdbs_python_pycentral),$(error unsupported Python system: $(DEB_PYTHON_SYSTEM) (select either python2, pysupport or pycentral)))
 
 # warning pysupport compatibility mode
 $(if $(cdbs_python_pysupport),$(if $(cdbs_python_use_xs_field),$(warning WARNING:  Use of XS-Python-Version and XB-Python-Version fields in debian/control is deprecated with pysupport method; use debian/pyversions if you need to specify specific versions.)))
diff -Nru cdbs-0.4.89/debian/changelog cdbs-0.4.90/debian/changelog
--- cdbs-0.4.89/debian/changelog	2010-09-16 11:11:03.000000000 +0200
+++ cdbs-0.4.90/debian/changelog	2010-11-21 01:26:56.000000000 +0100
@@ -1,3 +1,13 @@
+cdbs (0.4.90) UNRELEASED; urgency=low
+
+  * Add python3-distutils.mk for Python3 support;
+    build depend on python3-all-dev (for tests and dh_python3)
+  * DEB_PYTHON_SYSTEM now accepts "python2" keyword which will invoke
+    dh_python2; tests/distutils-9.sh added
+  * No longer creates debian/pycompat files in clean rule. Closes: #424898
+
+ -- Piotr Ożarowski <piotr@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 -Nru cdbs-0.4.89/debian/control cdbs-0.4.90/debian/control
--- cdbs-0.4.89/debian/control	2010-09-16 11:11:07.000000000 +0200
+++ cdbs-0.4.90/debian/control	2010-11-14 14:42:20.000000000 +0100
@@ -9,6 +9,7 @@
  fakeroot,
  python-dev,
  python-all-dev,
+ python3-all-dev,
  python-central,
  python-support,
  libxml2-utils,
diff -Nru cdbs-0.4.89/debian/control.in cdbs-0.4.90/debian/control.in
--- cdbs-0.4.89/debian/control.in	2010-07-31 18:18:50.000000000 +0200
+++ cdbs-0.4.90/debian/control.in	2010-11-15 18:33:05.000000000 +0100
@@ -8,6 +8,7 @@
  fakeroot,
  python-dev,
  python-all-dev,
+ python3-all-dev,
  python-central,
  python-support,
  libxml2-utils,
diff -Nru cdbs-0.4.89/Makefile.am cdbs-0.4.90/Makefile.am
--- cdbs-0.4.89/Makefile.am	2010-05-22 22:52:01.000000000 +0200
+++ cdbs-0.4.90/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 -Nru cdbs-0.4.89/Makefile.in cdbs-0.4.90/Makefile.in
--- cdbs-0.4.89/Makefile.in	2010-05-22 22:52:01.000000000 +0200
+++ cdbs-0.4.90/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 -Nru cdbs-0.4.89/test/distutils/src/foo.py cdbs-0.4.90/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/test/distutils/src/foo.py	2010-11-20 23:48:08.000000000 +0100
@@ -4,5 +4,5 @@
     self.id = 555
 
   def output(self):
-    print self.name
-    print self.id
+    print(self.name)
+    print(self.id)
diff -Nru cdbs-0.4.89/test/distutils-10.sh cdbs-0.4.90/test/distutils-10.sh
--- cdbs-0.4.89/test/distutils-10.sh	1970-01-01 01:00:00.000000000 +0100
+++ cdbs-0.4.90/test/distutils-10.sh	2010-11-21 01:17:31.000000000 +0100
@@ -0,0 +1,71 @@
+#!/bin/bash
+# -*- mode: sh; coding: utf-8 -*-
+# Copyright © 2006 Peter Eisentraut <petere@debian.org>
+# Copyright © 2009 Jonas Smedegaard <dr@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 -Nru cdbs-0.4.89/test/distutils-11.sh cdbs-0.4.90/test/distutils-11.sh
--- cdbs-0.4.89/test/distutils-11.sh	1970-01-01 01:00:00.000000000 +0100
+++ cdbs-0.4.90/test/distutils-11.sh	2010-11-21 00:09:57.000000000 +0100
@@ -0,0 +1,48 @@
+#!/bin/bash
+# -*- mode: sh; coding: utf-8 -*-
+# Copyright © 2006 Peter Eisentraut <petere@debian.org>
+# Copyright © 2009 Jonas Smedegaard <dr@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 -Nru cdbs-0.4.89/test/distutils-9.sh cdbs-0.4.90/test/distutils-9.sh
--- cdbs-0.4.89/test/distutils-9.sh	1970-01-01 01:00:00.000000000 +0100
+++ cdbs-0.4.90/test/distutils-9.sh	2010-11-14 14:53:28.000000000 +0100
@@ -0,0 +1,59 @@
+#!/bin/bash
+# -*- mode: sh; coding: utf-8 -*-
+# Copyright © 2006 Peter Eisentraut <petere@debian.org>
+# Copyright © 2009 Jonas Smedegaard <dr@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 + tarball w/ dh_python2
+
+. 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
+include debian/testsuite.mk
+include \$(_cdbs_package_root_dir)/1/rules/tarball.mk.in
+include \$(_cdbs_package_root_dir)/1/rules/debhelper.mk.in
+include \$(_cdbs_package_root_dir)/1/class/python-distutils.mk.in
+DEB_PYTHON_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.
+EOF
+
+# Make sure tarball is in place for this test.
+test_tarballs
+cp tarballs/distutils-test-0.1.tar.gz $WORKDIR
+
+build_package
+
+dpkg -c $WORKDIR/../python-cdbs-testsuite_0.1_*.deb \
+	| grep -q '/usr/share/pyshared/testing/foo.py' \
+	|| return_fail
+
+clean_workdir
+return_pass
diff -Nru cdbs-0.4.89/test/Makefile.am cdbs-0.4.90/test/Makefile.am
--- cdbs-0.4.89/test/Makefile.am	2010-05-22 22:52:01.000000000 +0200
+++ cdbs-0.4.90/test/Makefile.am	2010-11-20 23:18:45.000000000 +0100
@@ -46,6 +46,9 @@
 	distutils-6.sh \
 	distutils-7.sh \
 	distutils-8.sh \
+	distutils-9.sh \
+	distutils-10.sh \
+	distutils-11.sh \
 	ant-1.sh
 
 TARBALLS = tarballs/autotools-test-0.1.tar.gz \
diff -Nru cdbs-0.4.89/test/Makefile.in cdbs-0.4.90/test/Makefile.in
--- cdbs-0.4.89/test/Makefile.in	2010-05-22 22:52:01.000000000 +0200
+++ cdbs-0.4.90/test/Makefile.in	2010-11-21 01:18:10.000000000 +0100
@@ -148,6 +148,9 @@
 	distutils-6.sh \
 	distutils-7.sh \
 	distutils-8.sh \
+	distutils-9.sh \
+	distutils-10.sh \
+	distutils-11.sh \
 	ant-1.sh
 
 TARBALLS = tarballs/autotools-test-0.1.tar.gz \

Attachment: signature.asc
Description: Digital signature


Reply to: