Le mer 13/08/2003 à 13:26, Ross Burton a écrit : > > I can also add a -V option handling to dh_python, so that you can choose > > which python version you want the modules to be compiled with. Do you > > think it would be useful ? > > If you did add it, I would use it here. :) Can you try the attached patch for dh_python ? If it works fine for you, I'll forward it to joeyh. -- .''`. Josselin Mouette /\./\ : :' : josselin.mouette@ens-lyon.org `. `' joss@debian.org `- Debian GNU/Linux -- The power of freedom
--- /usr/bin/dh_python 2003-08-11 21:31:44.000000000 +0200
+++ dh_python 2003-08-13 13:59:01.000000000 +0200
@@ -12,7 +12,7 @@
=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 @@
/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 @@
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 @@
# 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 @@
$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 @@
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 @@
}
$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;
}
Attachment:
signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=