I've attached a patch that will make dh-python Multi-Arch aware by making
use of the environment variable DPKG_MAINTSCRIPT_ARCH which is provided in
the environment by dpkg.

Specifying the architecture this way will prevent a failure that requires
the human administrator to fix.  With version 3.5.1-4 of python3-minimal it
will unfortunately redundantly compile packages when multiple architecture
variants provide the same python modules.  However, I've submitted a patch
to python3-minimal that would correct that behavior.

See bug #838193 for the changes I propose to python3-minimal.
diff --git a/autoscripts/postinst-py3compile b/autoscripts/postinst-py3compile
index 333395b..3d22fc7 100644
--- a/autoscripts/postinst-py3compile
+++ b/autoscripts/postinst-py3compile
@@ -1,3 +1,3 @@
 if which py3compile >/dev/null 2>&1; then
-	py3compile -p #PACKAGE# #ARGS#
+	py3compile -p #PACKAGE#:$DPKG_MAINTSCRIPT_ARCH #ARGS#
 fi
diff --git a/autoscripts/prerm-py3clean b/autoscripts/prerm-py3clean
index c0aadfa..45c8cf2 100644
--- a/autoscripts/prerm-py3clean
+++ b/autoscripts/prerm-py3clean
@@ -1,6 +1,6 @@
 if which py3clean >/dev/null 2>&1; then
-	py3clean -p #PACKAGE# #ARGS#
+	py3clean -p #PACKAGE#:$DPKG_MAINTSCRIPT_ARCH #ARGS#
 else
-	dpkg -L #PACKAGE# | perl -ne 's,/([^/]*)\.py$,/__pycache__/\1.*, or next; unlink $_ or die $! foreach glob($_)'
+	dpkg -L #PACKAGE#:$DPKG_MAINTSCRIPT_ARCH | perl -ne 's,/([^/]*)\.py$,/__pycache__/\1.*, or next; unlink $_ or die $! foreach glob($_)'
 	find /usr/lib/python3/dist-packages/ -type d -name __pycache__ -empty -print0 | xargs --null --no-run-if-empty rmdir
 fi
diff --git a/debian/changelog b/debian/changelog
index 253edae..a1dd124 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,14 @@
-dh-python (2.201609XX) UNRELEASED; urgency=medium
+dh-python (2.201609XX+nmu1) UNRELEASED; urgency=medium
 
+  [ Piotr Ożarowski ]
   * pybuild.pm:
     - enable --test-{nose,pytest,tox} if appropriate pypy-* build
       dependency is set
 
- -- Piotr Ożarowski <pi...@debian.org>  Wed, 07 Sep 2016 22:39:27 +0200
+  [ Joe Crayne ]
+  * python3 autoscripts: support for Multi-Arch: same.
+
+ -- Joe Crayne <oh.hello....@gmail.com>  Sun, 18 Sep 2016 03:11:04 -0400
 
 dh-python (2.20160818) unstable; urgency=medium
 

Reply via email to