[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: RFS: plastex

How common is this? i.e. would it be time to implement something like
dh_pystrip debhelper thingi?


On 7/20/07, François Févotte <francois.fevotte@ensta.org> wrote:

On 7/20/07, Carl Fürstenberg <azatoth@gmail.com> wrote:
> lintian spits out warnings about -x flag on the py-files, as they all
> has a shebang, also the setup.py generates a cgpdfpng that only will
> work under OSX, but I don't know a good way to fix that.

to remove unneeded shebang lines, I usually use a small perl script
called at the end of debian/rules. I find this much more flexible than
maintaining a set of patches.

For example, this is the line I add in the debian/rules file:
   perl debian/strip_shebang $(DESTDIR)/usr/share/exaile/plugins/*.py

and the perl script: debian/strip_shebang
 #! /usr/bin/perl

use strict;

while (my $file = shift)
    print STDERR "Stripping shebang from file: `$file'\n";

    my $tmpfile = $file.'.tmp';
    system ('cp', $file, $tmpfile);

    open IN, $tmpfile
        or die ("could not open file `$tmpfile': $!\n");

    open OUT, ">$file"
        or die ("could not open file `$file': $!\n");

    # Only copy the first line if it is not a shebang line
    $_ = <IN>;
    print OUT unless (/^\#!/);

    # Copy all other lines
    while (<IN>)
        print OUT;

    close IN;
    close OUT;

    system ('rm', $tmpfile);

I'm sure this is not perfect and there is much room for improvement,
but still it seems to work pretty well.


PS: I am not a DD, so I can not sponsor your package. I hope you'll
find a sponsor very soon, though.

Reply to: