From 42c7a7a58ae32590ad3cc4928fb622e62922512b Mon Sep 17 00:00:00 2001 From: joey Date: Wed, 13 Aug 2003 15:50:36 +0000 Subject: r1588: * dh_python: Add a -V flag to choose the python version modules in a package use. Patch from Josselin, of course. --- debian/changelog | 7 +++++++ dh_python | 27 +++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 65e14054..a51c88ed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +debhelper (4.1.64) unstable; urgency=low + + * dh_python: Add a -V flag to choose the python version modules in a package + use. Patch from Josselin, of course. + + -- Joey Hess Wed, 13 Aug 2003 11:48:22 -0400 + debhelper (4.1.63) unstable; urgency=low * dh_python: patch from Josselin to fix generated depends. Closes: #204717 diff --git a/dh_python b/dh_python index f677ee2e..8b248ff6 100755 --- a/dh_python +++ b/dh_python @@ -12,7 +12,7 @@ use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS -B [S>] [B<-n>] [S>] +B [S>] [B<-n>] [B<-V> I] [S>] =head1 DESCRIPTION @@ -43,6 +43,13 @@ command line. By default, it will check /usr/lib/site-python, /usr/lib/$PACKAGE, /usr/share/$PACKAGE, /usr/lib/games/$PACKAGE, /usr/share/games/$PACKAGE and /usr/lib/python?.?/site-packages. +=item B<-V> I + +If the .py files your package ships are meant to be used by a specific +pythonX.Y version, you can set this option with the desired X.Y python +version. +Do not use if you ship modules in /usr/lib/site-python. + =item B<-n>, B<--noscripts> Do not modify postinst/postrm scripts. @@ -83,6 +90,13 @@ foreach (@python_allversions) { s/^/python/; } +# Check for -V +my $usepython = "python$python_version"; +if($dh{V_FLAG_SET}) { + $usepython = $dh{V_FLAG}; + $usepython =~ s/^/python/; +} + # Cleaning the paths given on the command line foreach (@ARGV) { s#/$##; @@ -92,6 +106,7 @@ foreach (@ARGV) { # dependency types use constant PROGRAM => 1; use constant PY_MODULE => 2; +use constant PY_MODULE_NONSTANDARD => 4; foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp = tmpdir($package); @@ -153,7 +168,11 @@ foreach my $package (@{$dh{DOPACKAGES}}) { $has_module = 1 if /\.py$/; }, "$tmp/$curdir" ; if ($has_module) { - $deps |= PY_MODULE; + if ($dh{V_FLAG_SET}) { + $verdeps{$usepython} |= PY_MODULE_NONSTANDARD; + } else { + $deps |= PY_MODULE; + } $dirlist="$dirlist /$curdir"; } } @@ -190,7 +209,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) { addsubstvar($package, "python:Depends", $pyver) if $verdeps{$pyver}; # And now, the postinst and prerm stuff - if ($pyver eq "python$python_version") { + if ($pyver eq "$usepython") { if ($verdeps{$pyver} & PY_MODULE) { $pydir = $pydir.$dirlist; } else { @@ -198,7 +217,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) { } $verdeps{$pyver} |= PY_MODULE if($deps & PY_MODULE); } - if ($verdeps{$pyver} & PY_MODULE && ! $dh{NOSCRIPTS}) { + if ($verdeps{$pyver} & (PY_MODULE|PY_MODULE_NONSTANDARD) && ! $dh{NOSCRIPTS}) { autoscript($package,"postinst","postinst-python","s%#PYVER#%$pyver%;s%#DIRLIST#%$pydir%"); $need_prerm = 1; } -- cgit v1.2.3