]> git.donarmstrong.com Git - debhelper.git/blobdiff - Debian/Debhelper/Buildsystem/python_distutils.pm
python_distutils.pm: Support debhelper backports.
[debhelper.git] / Debian / Debhelper / Buildsystem / python_distutils.pm
index 4838cada3c7c5ca4ec5c042895e6b6093c3dfe0d..9cf12e11dbf46def416e71eb994ff89abb570d9d 100644 (file)
@@ -114,7 +114,10 @@ sub setup_py {
        # Take into account that the default Python must not be in
        # the requested Python versions.
        # Then, run setup.py with each available python, to build
-        # extensions for each.
+       # extensions for each.
+       # To allow backports of debhelper we don't pass
+       # --install-layout=deb to 'setup.py install` for those Python
+       # versions where the option is ignored by distutils/setuptools.
 
         my $python_default = `pyversions -d`;
         $python_default =~ s/^\s+//;
@@ -139,7 +142,17 @@ sub setup_py {
 
        foreach my $python (@python_requested, @python_dbg) {
                if (-x "/usr/bin/".$python) {
-                       $this->doit_in_sourcedir($python, "setup.py", $act, @_);
+                       if ( $act eq "install" and not
+                            ( ($python =~ /^python(?:-dbg)?$/
+                                and $python_default =~ /^python2.[2345]$/)
+                             or $python =~ /^python2.[2345](?:-dbg)?$/ )) {
+                               $this->doit_in_sourcedir($python, "setup.py",
+                                               $act, @_, "--install-layout=deb");
+                       }
+                       else {
+                               $this->doit_in_sourcedir($python, "setup.py",
+                                               $act, @_);
+                       }
                }
        }
 }
@@ -156,7 +169,6 @@ sub install {
                "--root=$destdir",
                "--no-compile",
                "-O0",
-               "--install-layout=deb",
                @_);
 }