- foreach my $python (@python_requested, @python_dbg) {
- if (-x "/usr/bin/".$python) {
- $this->doit_in_sourcedir($python, "setup.py", $act, @_);
+ foreach my $python (@python_dbg, @python_requested) {
+ if (-f "/usr/lib/$python/distutils/__init__.py") {
+ # 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.
+ 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, @_);
+ }