]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_python
Fix build system auto-selection breakage.
[debhelper.git] / dh_python
index 9fbedc4ced02ceec4ea73ae7626d7e9d2cde2d3c..8f8c378850a6308c927106c200221a7b5183da74 100755 (executable)
--- a/dh_python
+++ b/dh_python
@@ -2,7 +2,7 @@
 
 =head1 NAME
 
-dh_python - calculates python dependencies and adds postinst and prerm python scripts
+dh_python - calculates python dependencies and adds postinst and prerm python scripts (deprecated)
 
 =cut
 
@@ -16,6 +16,10 @@ B<dh_python> [S<I<debhelper options>>] [B<-n>] [B<-V> I<version>] [S<I<module di
 
 =head1 DESCRIPTION
 
+Note: This program is deprecated. You should use dh_pysupport or
+dh_pycentral instead. This program will do nothing if debian/pycompat
+or a Python-Version control file field exists.
+
 dh_python is a debhelper program that is responsible for generating the
 ${python:Depends} substitutions and adding them to substvars files. It
 will also add a postinst and a prerm script if required.
@@ -69,6 +73,18 @@ Python policy, version 0.3.7
 
 init();
 
+if (-e "debian/pycompat") {
+       warning("Doing nothing since dh_pycompat exists; dh_pysupport or dh_pycentral should do the work. You can remove dh_python from your rules file.");
+       exit 0;
+}
+elsif (`grep Python-Version: debian/control`) {
+       warning("Doing nothing since Python-Version is set; dh_pysupport or dh_pycentral should do the work. You can remove dh_python from your rules file.");
+       exit 0;
+}
+else {
+       warning("This program is deprecated, you should use dh_pysupport or dh_pycentral instead.");
+}
+
 my $python = 'python';
 
 # The current python major version
@@ -88,7 +104,7 @@ elsif ($python_version =~ m/^Python\s+(\d+)\.(\d+)(\.\d+)*/) {
 my $python_nextversion = $python_version + 0.1;
 my $python_nextmajor = $python_major + 1;
 
-my @python_allversions = ('1.5','2.1','2.2','2.3');
+my @python_allversions = ('1.5','2.1','2.2','2.3','2.4');
 foreach (@python_allversions) {
        s/^/python/;
 }
@@ -139,8 +155,8 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                }
        }
        if ($package !~ /^python[0-9].[0-9]-/) {
-               push @dirs, "usr/lib/python$python_version/site-packages" ;
-               push @dirs_so, "usr/lib/python$python_version/site-packages" ;
+               push @dirs, "usr/lib/$usepython/site-packages";
+               push @dirs_so, "usr/lib/$usepython/site-packages";
                $look_for_pythonXY = 0;
        }