diff --git a/Makefile b/Makefile
index 3faf321308ef825b5688748ea1d0e9c99d6b71f2..135614d2235360cbb2ee6a64a182263faacebe0c 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ install-dev:
 	$(INSTALL) -m 755 runtime.d/* $(DESTDIR)$(PREFIX)/share/python/runtime.d/
 	$(INSTALL) -m 644 autoscripts/* $(DESTDIR)$(PREFIX)/share/debhelper/autoscripts/
 	$(INSTALL) -m 755 dh_python2 $(DESTDIR)$(PREFIX)/share/python/
-	$(INSTALL) -m 755 dh_python2.sh $(DESTDIR)$(PREFIX)/bin/dh_python2
+	$(INSTALL) -m 755 dh_python2.py $(DESTDIR)$(PREFIX)/bin/dh_python2
 	$(INSTALL) -m 644 python2.pm $(DESTDIR)$(PREFIX)/share/perl5/Debian/Debhelper/Sequence/
 
 install-runtime:
diff --git a/debian/changelog b/debian/changelog
index c8b88c4eacc45e3fdf5e7e5587cd7935e477dd70..2aa405683a22dd2940a703893128815ca2c0e41a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ python-defaults (2.7.5-5) unstable; urgency=low
   [ Piotr Ożarowski ]
   * Set "Multi-Arch: allowed" in python, python-dev, python-minimal,
     python-dbg, python-all, python-all-dev, python-all-dbg
+  * Replace /usr/bin/dh_python2 with a Python script that invokes
+    dh-python's dh_python2 if Build-Depends{,-Indep} contains dh-python
 
  -- Piotr Ożarowski <piotr@debian.org>  Thu, 12 Sep 2013 21:25:01 +0200
 
diff --git a/dh_python2.py b/dh_python2.py
new file mode 100755
index 0000000000000000000000000000000000000000..4a8e57aa8fdd7b44ad03b7b0dbb77465a127afe2
--- /dev/null
+++ b/dh_python2.py
@@ -0,0 +1,36 @@
+#! /usr/bin/python
+
+from os.path import exists
+from subprocess import call
+from sys import argv
+from re import compile
+
+OLD = '/usr/share/python/dh_python2'
+NEW = '/usr/share/dh-python/dh_python2'
+has_dhpython = compile(r'(^|:|\s|,)dh-python($|\s|,|\()').search
+
+binary = OLD
+if exists(NEW) and exists('debian/control'):
+    with open('debian/control', 'r') as fp:
+        inside = False
+        for line in fp:
+            if not line:
+                break
+            line_lower = line.lower()
+            if inside:
+                if line.startswith(' '):
+                    if has_dhpython(line):
+                        binary = NEW
+                        break
+                    continue
+                elif line.startswith('#'):
+                    continue
+                inside = False
+            if line_lower.startswith(('build-depends:', 'build-depends-indep:')):
+                if has_dhpython(line):
+                    binary = NEW
+                    break
+                inside = True
+
+argv[0] = binary
+exit(call(argv))
diff --git a/dh_python2.sh b/dh_python2.sh
deleted file mode 100755
index a6fd9d7d120a51ffbca5aa6adac2311c004851ef..0000000000000000000000000000000000000000
--- a/dh_python2.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /bin/sh
-
-if [ -f /usr/share/dh-python/dh_python2 ] &&\
-    grep -q dh-python ./debian/control 2>/dev/null
-then
-  exec /usr/share/dh-python/dh_python2 $@
-else
-  exec /usr/share/python/dh_python2 $@
-fi