summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoey <joey>2003-08-13 15:50:36 +0000
committerjoey <joey>2003-08-13 15:50:36 +0000
commit42c7a7a58ae32590ad3cc4928fb622e62922512b (patch)
tree77c89dd84c4d4a8306d56e4a286ffc26357451a8
parent81fa0a266942ff1a6edca7c06b952214210ffe2f (diff)
r1588: * dh_python: Add a -V flag to choose the python version modules in a package
use. Patch from Josselin, of course.
-rw-r--r--debian/changelog7
-rwxr-xr-xdh_python27
2 files changed, 30 insertions, 4 deletions
diff --git a/debian/changelog b/debian/changelog
index 65e1405..a51c88e 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 <joeyh@debian.org> 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 f677ee2..8b248ff 100755
--- a/dh_python
+++ b/dh_python
@@ -12,7 +12,7 @@ use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
-B<dh_python> [S<I<debhelper options>>] [B<-n>] [S<I<module dirs ...>>]
+B<dh_python> [S<I<debhelper options>>] [B<-n>] [B<-V> I<version>] [S<I<module dirs ...>>]
=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<version>
+
+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;
}