tag 520834 patch
thanks

On Sun, Mar 22, 2009 at 11:07:53PM +0100, David Paleino wrote:
> Package: debhelper
> Version: 7.2.6
> Severity: normal
> 
> Hello,
> I was packaging a python module, and I needed to build it with different 
> python
> modules.
> With debhelper 6 it would've been:
> 
> PYVERS=$(shell pyversions -r debian/control)
> 
> target:
>       for python in $(PYVERS); do \
>               $$python setup.py command; \
>       done
> 
> This goes for build, install, clean. I've read the code for dh_auto_build, and
> it directly calls "python". I believe it should run "pyversions -r
> debian/control", and run the versions it outputs. I haven't looked at
> dh_auto_install and dh_auto_clean, but I believe they should behave the same.

I support this as well. But building for multiple python versions is normally
only required if you are building an extension (a module written in e.g. C).

But since we do not know if we are building an extension or not, we should 
simply
assume we are doing it and run python?.? for every version listed by  
`pyversions -r`.

The attached patch implements the requested behavior.

PS. Please CC me on replies.

-- Patch description: 

commit 456db6ba8780f580c67eb37130d98ab215f535ea
Author: Julian Andres Klode <j...@debian.org>
Date:   Fri Apr 10 18:32:45 2009 +0200

    Support multiple python versions (Closes: #510855)
    
    Change the behaviour of the dh_auto_* scripts to get the requested
    Python versions from `pyversions -r` and build for all of them, instead
    of just the current Python version.

 dh_auto_build   |    4 +++-
 dh_auto_clean   |    4 +++-
 dh_auto_install |   10 ++++++----
 3 files changed, 12 insertions(+), 6 deletions(-)


-- 
Julian Andres Klode  - Free Software Developer
   Debian Developer  - Contributing Member of SPI
   Ubuntu Member     - Fellow of FSFE

Website: http://jak-linux.org/   XMPP: juli...@jabber.org
Debian:  http://www.debian.org/  SPI:  http://www.spi-inc.org/
Ubuntu:  http://www.ubuntu.com/  FSFE: http://www.fsfe.org/
From 3239e699923199858dd28da469041ae7961ca1fd Mon Sep 17 00:00:00 2001
From: Julian Andres Klode <j...@debian.org>
Date: Fri, 10 Apr 2009 18:32:45 +0200
Subject: [PATCH] Support multiple python versions (Closes: #520834)

Change the behaviour of the dh_auto_* scripts to get the requested
Python versions from `pyversions -r` and build for all of them, instead
of just the current Python version.
---
 dh_auto_build   |    4 +++-
 dh_auto_clean   |    4 +++-
 dh_auto_install |   10 ++++++----
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/dh_auto_build b/dh_auto_build
index 75ce51c..087e799 100755
--- a/dh_auto_build
+++ b/dh_auto_build
@@ -43,7 +43,9 @@ if (-e "Makefile" || -e "makefile" || -e "GNUmakefile") {
 	doit(exists $ENV{MAKE} ? $ENV{MAKE} : "make", @{$dh{U_PARAMS}});
 }
 elsif (-e "setup.py") {
-	doit("python", "setup.py", "build", @{$dh{U_PARAMS}});
+	for my $python (split ' ', `pyversions -r`) {
+		doit($python, "setup.py", "build", @{$dh{U_PARAMS}});
+	}
 }
 elsif (-e "Build.PL" && -e "Build") {
 	$ENV{MODULEBUILDRC} = "/dev/null";
diff --git a/dh_auto_clean b/dh_auto_clean
index 610155a..d98cfe6 100755
--- a/dh_auto_clean
+++ b/dh_auto_clean
@@ -54,7 +54,9 @@ if (-e "Makefile" || -e "makefile" || -e "GNUmakefile") {
 	}
 }
 elsif (-e "setup.py") {
-	doit("python", "setup.py", "clean", "-a", @{$dh{U_PARAMS}});
+	for my $python (split ' ', `pyversions -r`) {
+		doit($python, "setup.py", "clean", "-a", @{$dh{U_PARAMS}});
+	}
 	# The setup.py might import files, leading to python creating pyc
 	# files.
 	doit('find', '.', '-name', '*.pyc', '-exec', 'rm', '{}', ';');
diff --git a/dh_auto_install b/dh_auto_install
index 264725c..8f49a71 100755
--- a/dh_auto_install
+++ b/dh_auto_install
@@ -84,10 +84,12 @@ if (-e "Makefile" || -e "makefile" || -e "GNUmakefile") {
 	}
 }
 elsif (-e "setup.py") {
-	doit("python", "setup.py", "install", 
-		"--root=$destdir",
-		"--no-compile", "-O0",
-		@{$dh{U_PARAMS}});
+	for my $python (split ' ', `pyversions -r`) {
+		doit("python", "setup.py", "install",
+			"--root=$destdir",
+			"--no-compile", "-O0",
+			@{$dh{U_PARAMS}});
+	}
 }
 elsif (-e "Build.PL" && -e "Build") {
 	$ENV{MODULEBUILDRC} = "/dev/null";
-- 
1.6.2.2

Attachment: signature.asc
Description: Digital signature

Reply via email to