dh_pysupport is a debhelper program that will scan your package, detect
public modules in I</usr/share/python-support> and generate appropriate
postinst/prerm scripts to byte-compile modules installed there for all
available python versions.
It will also look for private Python modules and will byte-compile them
with the current Python version. You may have to list the directories
containing private Python modules.
If a file named I<debian/pyversions> exists, it is installed in
I</usr/share/python-support/$PACKAGE/.version>.
=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.
=item B<-d>
Force generation of dependency information.
In normal operation, dh_pysupport only generates complete dependency information when no I<debian/pycompat> file is found. With this option, it will be generated regardless.
=item B<-V> I<X.Y>
Force private modules to be bytecompiled with the specific I<X.Y> python version, regardless of the default python version on the system.
=item B<-X> I<item>, B<--exclude=>I<item>
Exclude files that contain "item" anywhere in their filename from being
taken into account to generate the python dependency. You may use this
option multiple times to build up a list of things to exclude.
=back
=head1 CONFORMS TO
Python policy as of 2006-08-10
=cut
init();
sub next_minor_version {
my $version = shift;
# Handles 2.10 -> 2.11 gracefully
my @items = split(/\./, $version);
$items[1] += 1;
$version = join(".", @items);
return $version;
}
# The current default python version
my $default=`pyversions -dv`;
chomp $default;
# All supported versions
my $allversions_string=`pyversions -sv`;
chomp $allversions_string;
my @allversions=split " ", $allversions_string;
# Use a specific version for private modules (doesn't affect public modules)
my $useversion;
if($dh{V_FLAG_SET}) {
$useversion = $dh{V_FLAG};
if (! grep { $_ eq $useversion } @allversions) {
error("Unknown python version $useversion");
}
}
# Generate dependencies if dh_python's debian/pycompat file isn't here
my $do_deps=1;
if (-f "debian/pycompat" && ! $dh{D_FLAG}) {
$do_deps=0;
}
foreach my $package (@{$dh{DOPACKAGES}}) {
my $tmp = tmpdir($package);
my $have_pydep=0; # This variable tells whether we have added some dependency
# on python one way or another.
# 1) Handle public python modules
# Move them to the python-support directories
doit (("pysupport-movemodules",$tmp));
# Then look for what the script found
foreach my $ps_dir (glob("$tmp/usr/share/python-support/*")) {