Package: python-support Version: 0.2.2 Since dh_python will not take care of python-support integration, you should provide a dh_pysupport ... here's a first implementation based on my initial dh_python work.
Feel free to enhance it (for example by moving the modules out of /usr/lib/pythonX.Y/ like you did in your previous dh_python that got later reverted.) I would appreciate a quick integration so that we can move forward with the python transition. :-) Cheers, -- Raphaël Hertzog Premier livre français sur Debian GNU/Linux : http://www.ouaza.com/livre/admin-debian/
#!/usr/bin/perl -w =head1 NAME dh_pysupport - use the python-support framework to handle Python modules and extensions =cut use strict; use File::Find; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS B<dh_pysupport> [S<I<debhelper options>>] [B<-n>] [S<I<module dirs ...>>] =head1 DESCRIPTION dh_pycentral is a debhelper program that will scan your package, detect public Python modules and move them in /usr/share/pycentral so that python-central can byte-compile those for all supported Python versions. You must of have filled the XS-Python-Header to indicate the set of python versions that are going to be supported. =head1 OPTIONS =over 4 =item I<module dirs> If your package installs private python modules in non-standard directories, you can make dh_pysupport check those directories by passing their names on the command line. By default, it will check /usr/lib/$PACKAGE, /usr/share/$PACKAGE, /usr/lib/games/$PACKAGE and /usr/share/games/$PACKAGE =item B<-n>, B<--noscripts> Do not modify postinst/postrm scripts. =back =head1 CONFORMS TO Python policy as of 2006-06-10 =cut init(); foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp = tmpdir($package); my @dirs = ("usr/lib/$package", "usr/share/$package", "usr/lib/games/$package", "usr/share/games/$package", @ARGV ); @dirs = grep -d, map "$tmp/$_", @dirs; # Look for private python modules my $dirlist=""; if (@dirs) { foreach my $curdir (@dirs) { my $has_module = 0; $curdir =~ s%^$tmp/%%; find sub { return unless -f; $has_module = 1 if (/\.py$/); }, "$tmp/$curdir" ; if ($has_module) { $dirlist="$dirlist /$curdir"; } } } if ($dirlist) { # We have private python modules # Use python-support to ensure that they are always # byte-compiled for the current version mkdir("$tmp/usr/share/python-support"); $dirlist =~ s/^\s*//; $dirlist =~ s/\s*$//; open(DIRLIST, "> $tmp/usr/share/python-support/$package.dirs") || error("Can't create $tmp/usr/share/python-support/$package.dirs: $!"); print DIRLIST join("\n", split(/\s+/, $dirlist)); close(DIRLIST); } # Add scripts to postinst/prerm depending on what we found if (-d "$tmp/usr/share/python-support") { addsubstvar($package, "python:Depends", "python-support"); foreach my $ps_dir (glob("$tmp/usr/share/python-support/*")) { if (-d $ps_dir) { $ps_dir =~ s/^$tmp//; if (! $dh{NOSCRIPTS}) { autoscript($package, "postinst", "postinst-python-support", "s,#OPTIONS#,-i,;s,#DIRS#,$ps_dir,"); autoscript($package, "prerm", "prerm-python-support", "s,#OPTIONS#,-i,;s,#DIRS#,$ps_dir,"); } # TODO: we should generate the # /usr/share/python-support/*/.version from # XS-Python-Version } elsif (-f $ps_dir) { # $ps_dir is a ".dirs" file ... $ps_dir =~ s/^$tmp//; autoscript($package, "postinst", "postinst-python-support", "s,#OPTIONS#,-b,;s,#DIRS#,$ps_dir,"); autoscript($package, "prerm", "prerm-python-support", "s,#OPTIONS#,-b,;s,#DIRS#,$ps_dir,"); } } } } =head1 SEE ALSO L<debhelper(7)> This program is a part of python-support but is made to work with debhelper. =head1 AUTHORS Josselin Mouette <[EMAIL PROTECTED]> Raphael Hertzog <[EMAIL PROTECTED]> =cut