home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / bin / dh_pycentral < prev    next >
Encoding:
Text File  |  2006-08-15  |  1.9 KB  |  86 lines

  1. #!/usr/bin/perl -w
  2.  
  3. =head1 NAME
  4.  
  5. dh_pycentral - use the python-central framework to handle Python modules and extensions
  6.  
  7. =cut
  8.  
  9. use strict;
  10. use File::Find;
  11. use Debian::Debhelper::Dh_Lib;
  12.  
  13. =head1 SYNOPSIS
  14.  
  15. B<dh_pycentral> [S<I<debhelper options>>] [B<-n>]
  16.  
  17. =head1 DESCRIPTION
  18.  
  19. dh_pycentral is a debhelper program that will scan your package, detect
  20. public Python modules and move them in /usr/share/pycentral so that
  21. python-central can byte-compile those for all supported Python versions.
  22. Extensions are kept into the original installation location.
  23.  
  24. Moving the files to the pycentral location can be disabled by setting
  25. the environment varibale DH_PYCENTRAL to a string containing the
  26. string B<nomove>.
  27.  
  28. You must have filled the XS-Python-Version header to indicate the
  29. set of python versions that are going to be supported. dh_pycentral
  30. expects the XB-Python-Version for each binary package it is supposed
  31. to work on.
  32.  
  33. =head1 OPTIONS
  34.  
  35. =over 4
  36.  
  37. =item B<-n>, B<--noscripts>
  38.  
  39. Do not modify postinst/postrm scripts.
  40.  
  41. =back
  42.  
  43. =head1 CONFORMS TO
  44.  
  45. Python policy as of 2006-06-10
  46.  
  47. =cut
  48.  
  49. init();
  50.  
  51.  
  52. foreach my $package (@{$dh{DOPACKAGES}}) {
  53.     my $tmp = tmpdir($package);
  54.  
  55.     # Move *.py files if needed
  56.     doit("pycentral debhelper $package $tmp");
  57.  
  58.     # Check that we have *.py files!
  59.     my $found = 0;
  60.     find sub {
  61.         return if $File::Find::dir =~ m|^$tmp/usr/share/doc/|;
  62.         return unless -f and /\.py$/;
  63.         $found++;
  64.     }, $tmp;
  65.  
  66.     if ($found or -d "$tmp/usr/share/pycentral") {
  67.                 addsubstvar($package, "python:Depends", "python-central", ">= 0.5");
  68.                 if (! $dh{NOSCRIPTS}) {
  69.                         autoscript($package,"postinst","postinst-pycentral","s%#PACKAGE#%$package%");
  70.                         autoscript($package,"prerm","prerm-pycentral","s%#PACKAGE#%$package%");
  71.                 }
  72.     }
  73. }
  74.  
  75. =head1 SEE ALSO
  76.  
  77. L<debhelper(7)>
  78.  
  79. This program is a part of python-central but is made to work with debhelper.
  80.  
  81. =head1 AUTHORS
  82.  
  83. Raphael Hertzog <hertzog@debian.org>
  84.  
  85. =cut
  86.