/usr/bin/dh_python-ply is in python-ply 3.7-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | #!/usr/bin/perl
=head1 NAME
dh_python-ply - generate versioned dependencies on python-ply
=cut
use strict;
use warnings;
use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
B<dh_python-ply> [B<--dependency-field> I<dependencyfield>] [S<I<debhelper options>>] I<file>...
=head1 DESCRIPTION
B<dh_python-ply> is a debhelper program that is responsible for generating the
B<python-ply:Depends> substitutions and adding them to substvars files.
The program will look only at Python modules that are explicitly provided as
its arguments, and will use this information to generate a strict versioned
dependency on B<python-ply>.
=head1 OPTIONS
=over 4
=item B<--dependency-field> I<dependencyfield>
Use B<python-ply:>I<dependencyfield> substitution variable instead of
B<python-ply:Depends>.
=back
=cut
my $dependency_field = "Depends";
init(options => { "dependency-field:s" => \$dependency_field });
if (not @ARGV)
{
error("at least one argument is required")
}
foreach my $filename (@ARGV)
{
open FILE, $filename or error("cannot read $filename: $!");
read FILE, $_, 1024;
my $is_lextab = /^_lextokens\b/m;
my $is_parsetab = /^_lr_method\b/m;
$is_lextab or $is_parsetab or error("$filename doesn't look like a PLY table");
(my $tabversion) = /^_tabversion\s*=\s*'([0-9.]+)'/m or error("$filename was generated by a very old PLY");
my $dependency = sprintf "python-ply-%s-%s", $is_lextab ? "lex" : "yacc", $tabversion;
# Prefer real package names of "old" versions of PLY for easier upgrades from squeeze:
if ($dependency eq "python-ply-yacc-3.2")
{
# PLY 3.2, 3.3 and 3.4 embeds the same version number (3.2) in parser tables.
$dependency = "python-ply (>= 3.2), python-ply (<< 3.5) | $dependency";
}
elsif ($dependency eq "python-ply-lex-3.3")
{
# PLY 3.3 and 3.4 embeds their own version number in lexer tables.
$dependency = "python-ply (>= 3.3), python-ply (<< 3.4) | $dependency";
}
foreach my $package (@{$dh{DOPACKAGES}})
{
addsubstvar($package, "python-ply:$dependency_field", $dependency);
}
}
=head1 SEE ALSO
L<debhelper(7)>
This program is not a part of debhelper, but it is meant to be used together with it.
=head1 AUTHOR
Jakub Wilk <jwilk@debian.org>
=cut
# vim:ts=4 sw=4 et
|