On Wed, Sep 12, 2012 at 05:58:22PM +0200, Jakub Wilk wrote:
> >+ #endif
> >++#ifdef MULTIARCH
> >++    {"." MULTIARCH ".so", "rb", C_EXTENSION},
> >++#endif
> >+     {".so", "rb", C_EXTENSION},
> >+     {"module.so", "rb", C_EXTENSION},
> >+ #endif
> 
> What about loading extensions for the -dbg interpreter?

Added, although I'm not sure how interesting multiarch is for debug
packages.

> Python modules from the standard library are not byte-compiled anymore.

This affects speed rather than functionality, so will look at it later

> At least the following files (that are shipped in a M-A: same
> package) vary with architecture:

> /usr/lib/python2.7/lib-dynload/*_d.so
> /usr/lib/python2.7/_sysconfigdata_nd.py
> /usr/lib/python2.7/lib-dynload/_sysconfigdata.py

hopefully fixed

> /usr/lib/python2.7/lib2to3/*Grammar*.pickle

Seem to be only used by 2to3 app, so moved whole lib2to3 directory to python2.7 
package
 
> These are broken symlinks:
> 
> /usr/lib/python2.7/config-*_d/libpython2.7_d.so
> /usr/lib/python2.7/config-*_d/libpython2.7.so
> /usr/lib/libpython2.7.a

fixed

> libpython2.7-{minimal,stdlib} don't ship any shared libraries, so
> Pre-Depends on multiarch-support shouldn't be needed.

dropped. 

> python2.7{,-minimal,-dbg} must not be "Multi-Arch: foreign".

I'll keep this now for my testings, it is trivial enough to remove
when needed.

> Apparently the patch reopens #684612.

> argparse.egg-info should be in libpython2.7-stdlib, not in python2.7.

Changed

Since you clearly know more about python than I do, do you have good
ideas howto verify that everything still works now that all the files
have been moved around? Even better if you want to test and finish the
patch yourself ;)

Riku


diff -u python2.7-2.7.3/debian/control python2.7-2.7.3/debian/control
--- python2.7-2.7.3/debian/control
+++ python2.7-2.7.3/debian/control
@@ -23,36 +23,67 @@
 Package: python2.7
 Architecture: any
 Priority: optional
-Depends: python2.7-minimal (= ${binary:Version}), mime-support, ${shlibs:Depends}, ${misc:Depends}
+Depends: python2.7-minimal (= ${binary:Version}), libpython2.7-stdlib (= ${binary:Version}), mime-support, ${shlibs:Depends}, ${misc:Depends}
 Suggests: python2.7-doc, binutils
-Provides: python2.7-cjkcodecs, python2.7-ctypes, python2.7-elementtree, python2.7-celementtree, python2.7-wsgiref, python2.7-profiler, python2.7-argparse, python-argparse
 Conflicts: python-profiler (<= 2.7.1-2)
 Breaks: python-virtualenv (<< 1.7.1.2-2~), vim-nox (<< 2:7.3.547-4), vim-gtk (<< 2:7.3.547-4), vim-gnome (<< 2:7.3.547-4), vim-athena (<< 2:7.3.547-4)
 Replaces: python-profiler (<= 2.7.1-2)
+Multi-Arch: foreign
+Description: Interactive high-level object-oriented language (version 2.7)
+ Version 2.7 of the high-level, interactive object oriented language,
+ includes an extensive class library with lots of goodies for
+ network programming, system administration, sounds and graphics.
+
+Package: libpython2.7-stdlib
+Architecture: any
+Multi-Arch: same
+Priority: optional
+Depends: libpython2.7-minimal (= ${binary:Version}), mime-support, ${shlibs:Depends}, ${misc:Depends}
+Suggests: python2.7-profiler
+Provides: python2.7-cjkcodecs, python2.7-ctypes, python2.7-elementtree, python2.7-celementtree, python2.7-wsgiref, python2.7-profiler, python2.7-argparse, python-argparse
+Replaces: python2.7 (<< 2.7.3-6)
 Description: Interactive high-level object-oriented language (version 2.7)
  Version 2.7 of the high-level, interactive object oriented language,
  includes an extensive class library with lots of goodies for
  network programming, system administration, sounds and graphics.
+ .
+ This package contains the standard library. It is normally not
+ used on it's own, but as a dependency of python2.7.
 
 Package: python2.7-minimal
 Architecture: any
 Priority: optional
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: libpython2.7-minimal (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Recommends: python2.7
 Suggests: binfmt-support
 Replaces: python2.7 (<< 2.7.1~rc1-2~)
 Conflicts: binfmt-support (<< 1.1.2)
+Multi-Arch: foreign
 Description: Minimal subset of the Python language (version 2.7)
  This package contains the interpreter and some essential modules.  It can
  be used in the boot process for some basic tasks.
  See /usr/share/doc/python2.7-minimal/README.Debian for a list of the modules
  contained in this package.
 
+Package: libpython2.7-minimal
+Architecture: any
+Multi-Arch: same
+Priority: optional
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: libpython2.7-stdlib
+Replaces: python2.7 (<< 2.7.1~rc1-2~), python2.7-minimal (<< 2.7.3-6)
+Conflicts: binfmt-support (<< 1.1.2)
+Description: Minimal subset of the Python language (version 2.7)
+ This package contains some essential modules. It is normally not
+ used on it's own, but as a dependency of python2.7-minimal.
+
 Package: libpython2.7
 Architecture: any
+Multi-Arch: same
 Section: libs
 Priority: optional
-Depends: python2.7 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Pre-Depends: multiarch-support
+Depends: libpython2.7-stdlib (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Replaces: python2.7 (<< 2.6)
 Description: Shared Python runtime library (version 2.7)
  Version 2.7 of the high-level, interactive object oriented language,
@@ -71,7 +102,7 @@
 
 Package: python2.7-dev
 Architecture: any
-Depends: python2.7 (= ${binary:Version}), libpython2.7 (= ${binary:Version}), libexpat1-dev, libssl-dev, ${shlibs:Depends}, ${misc:Depends}
+Depends: python2.7 (= ${binary:Version}), libpython2.7-dev (= ${binary:Version}), libpython2.7 (= ${binary:Version}), libexpat1-dev, libssl-dev, ${shlibs:Depends}, ${misc:Depends}
 Recommends: libc6-dev | libc-dev
 Replaces: python2.7 (<< 2.7-3)
 Description: Header files and a static library for Python (v2.7)
@@ -81,6 +112,24 @@
  .
  Maintainers of Python packages should read README.maintainers.
 
+Package: libpython2.7-dev
+Section: libdevel
+Architecture: any
+Multi-Arch: same
+Pre-Depends: multiarch-support
+Depends: libpython2.7-stdlib (= ${binary:Version}), libpython2.7 (= ${binary:Version}), libssl-dev, libexpat1-dev, ${shlibs:Depends}, ${misc:Depends}
+Replaces: python2.7 (<< 2.7-3), python2.7-dev (<< 2.7.3-6), python2.7-minimal (<< 2.7.3-6)
+Recommends: libc6-dev | libc-dev
+Description: Header files and a static library for Python (v2.7)
+ Header files, a static library and development tools for building
+ Python (v2.7) modules, extending the Python interpreter or embedding
+ Python (v2.7) in applications.
+ .
+ Maintainers of Python packages should read README.maintainers.
+ .
+ This package contains development files. It is normally not
+ used on it's own, but as a dependency of python2.7-dev.
+
 Package: idle-python2.7
 Architecture: all
 Depends: python2.7, python-tk (>= 2.6~a3), python2.7-tk, ${misc:Depends}
@@ -118,5 +167,23 @@
-Depends: python2.7 (>= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Depends: python2.7 (= ${binary:Version}), libpython2.7-dbg (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Suggests: python-gdbm-dbg, python-tk-dbg
+Multi-Arch: foreign
 Description: Debug Build of the Python Interpreter (version 2.7)
  Python interpreter configured with --pydebug. Dynamically loaded modules are
  searched in /usr/lib/python2.7/lib-dynload/debug first.
+
+Package: libpython2.7-dbg
+Section: debug
+Architecture: any
+Multi-Arch: same
+Priority: extra
+Pre-Depends: multiarch-support
+Depends: libpython2.7-stdlib (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}, python
+Suggests: python2.7-gdbm-dbg, python2.7-tk-dbg
+Replaces: python2.7-dbg (<< 2.7.3-6)
+Description: Debug Build of the Python Interpreter (version 2.7)
+ Python interpreter configured with --pydebug. Dynamically loaded modules are
+ searched in /usr/lib/python2.7/lib-dynload/debug first.
+ .
+ This package contains the library for the debug interpreter. It is normally
+ not used on it's own, but as a dependency of python2.7.
+
diff -u python2.7-2.7.3/debian/PVER-minimal.README.Debian.in python2.7-2.7.3/debian/PVER-minimal.README.Debian.in
--- python2.7-2.7.3/debian/PVER-minimal.README.Debian.in
+++ python2.7-2.7.3/debian/PVER-minimal.README.Debian.in
@@ -26,7 +26,6 @@
   _struct		extension
   _symtable		builtin
   _sysconfigdata	module
-  _sysconfigdata_nd	module
   _types		builtin
   _warnings		builtin
   _weakref		extension
diff -u python2.7-2.7.3/debian/rules python2.7-2.7.3/debian/rules
--- python2.7-2.7.3/debian/rules
+++ python2.7-2.7.3/debian/rules
@@ -15,6 +15,7 @@
 DEB_HOST_ARCH		?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH)
 DEB_HOST_ARCH_BITS	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH_BITS)
 DEB_HOST_ARCH_OS	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH_OS)
+DEB_HOST_MULTIARCH	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_MULTIARCH)
 
 changelog_values := $(shell dpkg-parsechangelog \
 			| awk '/^(Version|Source):/ {print $$2}')
@@ -163,6 +164,11 @@
 p_doc	:= $(PVER)-doc
 p_dbg	:= $(PVER)-dbg
 
+p_lbase	:= lib$(PVER)-stdlib
+p_lmin	:= lib$(PVER)-minimal
+p_ldev	:= lib$(PVER)-dev
+p_ldbg	:= lib$(PVER)-dbg
+
 d_base	:= debian/$(p_base)
 d_min	:= debian/$(p_min)
 d_lib	:= debian/$(p_lib)
@@ -174,6 +180,11 @@
 d_doc	:= debian/$(p_doc)
 d_dbg	:= debian/$(p_dbg)
 
+d_lbase	:= debian/$(p_lbase)
+d_lmin	:= debian/$(p_lmin)
+d_ldev	:= debian/$(p_ldev)
+d_ldbg	:= debian/$(p_ldbg)
+
 build-arch: stamps/stamp-build
 build-indep: stamps/stamp-build-doc
 build: build-arch
@@ -585,6 +596,7 @@
 	rm -rf $(buildd_static) $(buildd_shared) $(buildd_debug) $(buildd_shdebug)
 	find -name '*.py[co]' | xargs -r rm -f
 	rm -f Lib/lib2to3/*.pickle
+	rm -rf Lib/plat-$(DEB_HOST_MULTIARCH)
 	rm -rf locales
 	rm -rf $(d)-dbg
 
@@ -634,25 +646,34 @@
 else
 	$(MAKE) -C $(buildd_shared) install prefix=$(CURDIR)/$(d)/usr
 endif
+	mkdir -p $(d)/$(scriptdir)/plat-$(DEB_HOST_MULTIARCH)/
 	mv $(d)/$(scriptdir)/_sysconfigdata.py \
-		$(d)/$(scriptdir)/_sysconfigdata_nd.py
+		$(d)/$(scriptdir)/plat-$(DEB_HOST_MULTIARCH)/_sysconfigdata_nd.py
 	sed -i 's/ -O3 / -O2 /g;s/$(LTO_CFLAGS)//g' \
-		$(d)/$(scriptdir)/_sysconfigdata_nd.py
-	cp -p debian/_sysconfigdata.py $(d)/$(scriptdir)/
+		$(d)/$(scriptdir)/plat-$(DEB_HOST_MULTIARCH)/_sysconfigdata_nd.py
+	cp -p debian/_sysconfigdata.py $(d)/$(scriptdir)
 
 	-find $(d)/usr/lib/python$(VER) -name '*_failed*.so'
 	find $(d)/usr/lib/python$(VER) -name '*_failed*.so' | xargs -r rm -f
 
 	test -f $(d)/usr/lib/python$(VER)/lib-dynload/_bsddb.so
 
+	for i in $(d)/$(scriptdir)/lib-dynload/*.so; do \
+	  b=$$(basename $$i .so); \
+	  d=$${b}.$(DEB_HOST_MULTIARCH).so; \
+	  mv $$i $(d)/$(scriptdir)/lib-dynload/$$d; \
+	done
+
+	mv $(d)/usr/lib/libpython*.a $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/
+
 	mv $(d)/usr/lib/python$(VER)/site-packages \
 		$(d)/usr/lib/python$(VER)/dist-packages
 
 	: # remove files, which are not packaged
 	rm -f $(d)/usr/bin/smtpd.py
 	rm -rf $(d)/usr/lib/python$(VER)/ctypes/macholib
-	rm -f $(d)/usr/lib/pkgconfig/python.pc
-	rm -f $(d)/usr/lib/pkgconfig/python2.pc
+	rm -f $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python.pc
+	rm -f $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python2.pc
 	rm -f $(d)/usr/bin/python2{,-config}
 	rm -f $(d)/usr/share/man/man1/python2{,-config}.1
 
@@ -689,16 +710,21 @@
 		$(d)/$(scriptdir)/lib-dynload/Python-$(VER).egg-info
 
 	dh_installdirs -p$(p_lib) \
-		$(scriptdir)/config \
+		usr/lib/$(DEB_HOST_MULTIARCH) \
+		$(scriptdir)/config-$(DEB_HOST_MULTIARCH) \
 		usr/share/doc
 	: # install the shared library
-	cp -p $(buildd_shared)/libpython$(VER).so.1.0 $(d_lib)/usr/lib/
-	ln -sf libpython$(VER).so.1.0 $(d_lib)/usr/lib/libpython$(VER).so.1
-	ln -sf ../../libpython$(VER).so.1 \
-		$(d_lib)/$(scriptdir)/config/libpython$(VER).so
+	cp -p $(buildd_shared)/libpython$(VER).so.1.0 \
+		$(d_lib)/usr/lib/$(DEB_HOST_MULTIARCH)/
+	dh_link -p$(p_lib) \
+	    /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so.1.0 \
+		/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so.1 \
+	    /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so.1 \
+		/$(scriptdir)/config-$(DEB_HOST_MULTIARCH)/libpython$(VER).so
+
 	ln -sf $(p_base) $(d_lib)/usr/share/doc/$(p_lib)
 
-	ln -sf libpython$(VER).so.1 $(d)/usr/lib/libpython$(VER).so
+	ln -sf libpython$(VER).so.1 $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so
 
 ifeq ($(with_interp),shared)
 	: # install the statically linked runtime
@@ -713,67 +739,87 @@
 	sed -e '/^OPT/s,-O3,-O2,' \
 	    -e 's/$(LTO_CFLAGS)//g' \
 	    -e 's,^RUNSHARED *=.*,RUNSHARED=,' \
-		build-shared/Makefile > $(d)/$(scriptdir)/config/Makefile
+		build-shared/Makefile > $(d)/$(scriptdir)/config-$(DEB_HOST_MULTIARCH)/Makefile
 
-	: # Move the binary and the minimal libraries into $(p_min).
-	dh_installdirs -p$(p_min) \
+	: # Move the binary and the minimal libraries into $(p_lmin).
+	dh_installdirs -p$(p_lmin) \
 		etc/$(PVER) \
 		usr/bin \
 		usr/include/$(PVER) \
 		usr/share/man/man1 \
 		$(scriptdir)/lib-dynload \
-		$(scriptdir)/config
-	DH_COMPAT=2 dh_movefiles -p$(p_min) --sourcedir=$(d) \
-		usr/bin/python$(VER) \
-		usr/share/man/man1/python$(VER).1 \
+		$(scriptdir)/config-$(DEB_HOST_MULTIARCH)
+	DH_COMPAT=2 dh_movefiles -p$(p_lmin) --sourcedir=$(d) \
 		$(foreach i,$(MIN_MODS),$(scriptdir)/$(i).py) \
 		$(foreach i,$(MIN_PACKAGES),$(scriptdir)/$(i)) \
 		$(foreach i,$(MIN_ENCODINGS),$(scriptdir)/$(i)) \
-		$(scriptdir)/config/Makefile \
-		usr/include/$(PVER)/pyconfig.h \
+		$(scriptdir)/config-$(DEB_HOST_MULTIARCH)/Makefile \
+		/$(scriptdir)/plat-$(DEB_HOST_MULTIARCH)/_sysconfigdata_nd.py \
+		usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)/pyconfig.h \
 		$(scriptdir)/site.py \
 		$(shell cd $(d); for i in $(MIN_EXTS); do \
 			test -e $(scriptdir)/lib-dynload/$$i.so \
 			  && echo $(scriptdir)/lib-dynload/$$i.so; \
 		  done; true)
 
+	: # Move the binary and the minimal libraries into $(p_min).
+	dh_installdirs -p$(p_min) \
+		usr/bin \
+		usr/share/man/man1
+	DH_COMPAT=2 dh_movefiles -p$(p_min) --sourcedir=$(d) \
+		usr/bin/python$(VER) \
+		usr/share/man/man1/python$(VER).1
+
 	: # Install sitecustomize.py.
-	cp -p debian/sitecustomize.py $(d_min)/etc/$(PVER)/
-	patch --no-backup -d $(d_min)/$(scriptdir) < debian/patches/site-builddir.diff
-	dh_link -p$(p_min) /etc/$(PVER)/sitecustomize.py \
+	cp -p debian/sitecustomize.py $(d_lmin)/etc/$(PVER)/
+	patch --no-backup -d $(d_lmin)/$(scriptdir) < debian/patches/site-builddir.diff
+	dh_link -p$(p_lmin) /etc/$(PVER)/sitecustomize.py \
 		/$(scriptdir)/sitecustomize.py
 
-	: # Move the static library and the header files into $(p_dev).
+	: # Move the static library and the header files into $(p_ldev).
 #	mv $(d)/usr/share/include/python$(VER)/* $(d)/usr/include/python$(VER)/.
 #	rm -rf $(d)/usr/share/include
-	dh_installdirs -p$(p_dev) \
-		usr/share/doc/python$(VER) \
+
+	cp $(d)/usr/bin/python$(VER)-config $(d)/usr/bin/$(DEB_HOST_MULTIARCH)-python-config
+	dh_installdirs -p$(p_ldev) \
+		usr/bin \
 		$(scriptdir) \
-		$(scriptdir)/doc/html \
 		usr/include \
+		usr/share/man/man1
+
+	DH_COMPAT=2 dh_movefiles -p$(p_ldev) --sourcedir=$(d) \
+		usr/bin/$(DEB_HOST_MULTIARCH)-python-config \
+		usr/lib/python$(VER)/config-$(DEB_HOST_MULTIARCH) \
+		usr/include \
+		usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).{a,so} \
+		usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER)*.pc
+
+	dh_link -p$(p_ldev) \
+		/usr/lib/$(PVER)/config-$(DEB_HOST_MULTIARCH)/libpython$(VER).a \
+		/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).a
+
+	cp -p $(buildd_shared)/libpython$(VER)-pic.a \
+		$(d_ldev)/usr/lib/python$(VER)/config-$(DEB_HOST_MULTIARCH)/
+
+	: # Move the static library and the header files into $(p_dev).
+	dh_installdirs -p$(p_dev) \
+		usr/share/doc/python$(VER)/$(DEB_HOST_MULTIARCH) \
 		usr/share/man/man1 \
-		usr/lib
+		$(scriptdir) \
+		$(scriptdir)/doc/html
+
 	cp -p Misc/HISTORY Misc/README.valgrind Misc/gdbinit \
 		debian/README.maintainers \
-		debian/test_results $(buildd_static)/pybench.log \
-	    $(d_dev)/usr/share/doc/python$(VER)/
+		$(d_dev)/usr/share/doc/python$(VER)/
+	cp -p	debian/test_results $(buildd_static)/pybench.log \
+		$(d_dev)/usr/share/doc/python$(VER)/$(DEB_HOST_MULTIARCH)/
 
 	DH_COMPAT=2 dh_movefiles -p$(p_dev) --sourcedir=$(d) \
-		usr/lib/python$(VER)/config \
-		usr/include/python$(VER) \
-		usr/lib/libpython$(VER).so \
-		usr/lib/libpython$(VER).a \
-		usr/lib/pkgconfig/python-$(VER).pc \
 		usr/bin/python$(VER)-config \
 		usr/lib/python$(VER)/distutils/command/wininst-*.exe
 
-	ln -sf $(PVER)/config/libpython$(VER).a \
-		$(d_dev)/usr/lib/libpython$(VER).a
-
 	cp -p debian/python-config.1 \
 		$(d_dev)/usr/share/man/man1/python$(VER)-config.1
-	cp -p $(buildd_shared)/libpython$(VER)-pic.a \
-		$(d_dev)/usr/lib/python$(VER)/config/
 
 ifeq ($(with_tk),yes)
 	: # Move the Tkinter files into $(p_tk).
@@ -882,6 +928,12 @@
 	cp -p debian/README.Tk $(d_tk)/usr/share/doc/$(p_tk)/
 endif
 
+	: # library files into $(p_lbase)
+	dh_installdirs -p$(p_lbase) \
+		usr/lib
+	dh_movefiles -p$(p_lbase) \
+		usr/lib/python$(VER) -Xlib2to3
+
 	: # The rest goes into $(p_base)
 	mkdir -p $(d)/usr/lib/python$(VER)/dist-packages
 	(cd $(d) && tar cf - .) | (cd $(d_base) && tar xpf -)
@@ -889,7 +941,7 @@
 	rm -f $(d_base)/usr/bin/python
 
 	: # install egg-info for arparse
-	install -m 644 debian/argparse.egg-info $(d_base)/$(scriptdir)/
+	install -m 644 debian/argparse.egg-info $(d_lbase)/$(scriptdir)/
 
 	: # Install menu icon
 	dh_installdirs -p$(p_base) usr/share/pixmaps
@@ -915,15 +967,46 @@
 	: # install debug package
 	rm -rf $(d)-dbg
 	$(MAKE) -C $(buildd_debug) install DESTDIR=$(CURDIR)/$(d)-dbg
+	mv $(d)-dbg/usr/lib/libpython*.a $(d)-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/
 	mv $(d)-dbg/$(scriptdir)/_sysconfigdata.py \
 		$(d)-dbg/$(scriptdir)/_sysconfigdata_d.py
-	dh_installdirs -p$(p_dbg) \
+
+	for i in $(d)-dbg/$(scriptdir)/lib-dynload/*_d.so; do \
+	  b=$$(basename $$i _d.so); \
+	  d=$${b}.$(DEB_HOST_MULTIARCH)_d.so; \
+	  mv $$i $(d)-dbg/$(scriptdir)/lib-dynload/$$d; \
+	done
+
+	dh_installdirs -p$(p_ldbg) \
 		usr/bin \
 		usr/share/man/man1 \
 		$(scriptdir)/lib-dynload \
+		$(scriptdir)/plat-$(DEB_HOST_MULTIARCH) \
 		usr/include/$(PVER)_d \
-		usr/lib/pkgconfig \
+		usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)_d \
+		usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \
+
+	cp -p $(d)-dbg/$(scriptdir)/lib-dynload/*.so \
+		$(d_ldbg)/$(scriptdir)/lib-dynload/
+	cp -p $(buildd_shdebug)/libpython$(VER)_d.so.1.0 \
+		$(d_ldbg)/usr/lib/$(DEB_HOST_MULTIARCH)/
+	dh_link -p$(p_ldbg) \
+		/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)_d.so.1.0 \
+		/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)_d.so.1 \
+		/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)_d.so.1 \
+		/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)_d.so
+	sed -e '/^Libs:/s,-lpython$(VER),-lpython$(VER)_d,' \
+		-e '/^Cflags:/s,python$(VER),python$(VER)_d,' \
+		$(d)-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER).pc \
+		> $(d_ldbg)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER)-dbg.pc
+
+
+	dh_installdirs -p$(p_dbg) \
+		usr/bin \
+		$(scriptdir)/lib-dynload \
+		usr/share/man/man1 \
 		usr/share/doc/$(p_base)
+
 	cp -p Misc/SpecialBuilds.txt $(d_dbg)/usr/share/doc/$(p_base)/
 	cp -p debian/$(PVER)-dbg.README.Debian \
 		$(d_dbg)/usr/share/doc/$(p_base)/README.debug
@@ -932,41 +1015,35 @@
 		$(d)-dbg/usr/bin/$(PVER)-config \
 		> $(d_dbg)/usr/bin/$(PVER)-dbg-config
 	chmod 755 $(d_dbg)/usr/bin/$(PVER)-dbg-config
-	cp -p $(buildd_debug)/build/lib*/*_d.so \
+#	cp -p $(buildd_debug)/build/lib*/*_d.so \
 		$(d_dbg)/$(scriptdir)/lib-dynload/
 	cp -p $(d)-dbg/$(scriptdir)/_sysconfigdata_d.py \
-		$(d_dbg)/$(scriptdir)/
-	cp -p $(buildd_shdebug)/libpython$(VER)_d.so.1.0 $(d_dbg)/usr/lib/
-	ln -sf libpython$(VER)_d.so.1.0 $(d_dbg)/usr/lib/libpython$(VER)_d.so.1
-	ln -sf libpython$(VER)_d.so.1 $(d_dbg)/usr/lib/libpython$(VER)_d.so
-	sed -e '/^Libs:/s,-lpython$(VER),-lpython$(VER)_d,' \
-	  -e '/^Cflags:/s,python$(VER),python$(VER)_d,' \
-	  $(d)-dbg/usr/lib/pkgconfig/python-$(VER).pc \
-	  > $(d_dbg)/usr/lib/pkgconfig/python-$(VER)-dbg.pc
+		$(d_ldbg)/$(scriptdir)/plat-$(DEB_HOST_MULTIARCH)/
 ifneq ($(with_gdbm),yes)
-	rm -f $(d_dbg)/$(scriptdir)/lib-dynload/gdbm_d.so
-	rm -f $(d_dbg)/usr/lib/debug/$(scriptdir)/lib-dynload/gdbm.so
+	rm -f $(d_ldbg)/$(scriptdir)/lib-dynload/gdbm_d.so
+	rm -f $(d_dbg)/usr/lib/debug/$(scriptdir)/lib-dynload/gdbm.$(DEB_HOST_MULTIARCH).so
 endif
 ifneq ($(with_tk),yes)
-	rm -f $(d_dbg)/$(scriptdir)/lib-dynload/_tkinter_d.so
-	rm -f $(d_dbg)/usr/lib/debug/$(scriptdir)/lib-dynload/_tkinter.so
+	rm -f $(d_ldbg)/$(scriptdir)/lib-dynload/_tkinter_d.so
+	rm -f $(d_dbg)/usr/lib/debug/$(scriptdir)/lib-dynload/_tkinter.$(DEB_HOST_MULTIARCH).so
 endif
 #	rm -f $(d_dbg)/$(scriptdir)/lib-dynload/_bsddb_d.so
 
-	cp -a $(d)-dbg/$(scriptdir)/config_d $(d_dbg)/$(scriptdir)/
-	ln -sf ../../libpython$(VER)_d.so \
-		$(d_dbg)/$(scriptdir)/config_d/libpython$(VER)_d.so
+	cp -a $(d)-dbg/$(scriptdir)/config-$(DEB_HOST_MULTIARCH)_d \
+		 $(d_ldbg)/$(scriptdir)/
+	ln -sf ../../../$(DEB_HOST_MULTIARCH)/libpython$(VER)_d.so \
+		$(d_ldbg)/$(scriptdir)/config-$(DEB_HOST_MULTIARCH)_d/libpython$(VER)_d.so
 	ln -sf libpython$(VER)_d.so \
-		$(d_dbg)/$(scriptdir)/config_d/libpython$(VER).so
+		$(d_ldbg)/$(scriptdir)/config-$(DEB_HOST_MULTIARCH)_d/libpython$(VER).so
 	ln -sf libpython$(VER)_d.a \
-		$(d_dbg)/$(scriptdir)/config_d/libpython$(VER).a
+		$(d_ldbg)/$(scriptdir)/config-$(DEB_HOST_MULTIARCH)_d/libpython$(VER).a
 
-	for i in $(d_dev)/usr/include/$(PVER)/*; do \
+	for i in $(d_ldev)/usr/include/$(PVER)/*; do \
 	  i=$$(basename $$i); \
 	  case $$i in pyconfig.h) continue; esac; \
-	  ln -sf ../$(PVER)/$$i $(d_dbg)/usr/include/$(PVER)_d/$$i; \
+	  ln -sf ../$(PVER)/$$i $(d_ldbg)/usr/include/$(PVER)_d/$$i; \
 	done
-	cp -p $(buildd_debug)/pyconfig.h $(d_dbg)/usr/include/$(PVER)_d/
+	cp -p $(buildd_debug)/pyconfig.h $(d_ldbg)/usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)_d/
 	ln -sf $(PVER).1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg.1.gz
 	ln -sf $(PVER)-config.1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg-config.1.gz
 
@@ -1039,16 +1116,24 @@
 	-dh_icons -a || dh_iconcache -a
 #	dh_installmime -a
 	dh_installchangelogs -a
-	for i in $(p_dev) $(p_dbg) $(p_lib); do \
+	for i in $(p_dev) $(p_dbg); do \
 	  rm -rf debian/$$i/usr/share/doc/$$i; \
 	  ln -s $(p_base) debian/$$i/usr/share/doc/$$i; \
 	done
+	for i in $(p_lbase); do \
+	  rm -rf debian/$$i/usr/share/doc/$$i; \
+	  ln -s $(p_lmin) debian/$$i/usr/share/doc/$$i; \
+	done
+	for i in $(p_ldev) $(p_ldbg) $(p_lib); do \
+	  rm -rf debian/$$i/usr/share/doc/$$i; \
+	  ln -s $(p_lbase) debian/$$i/usr/share/doc/$$i; \
+	done
 	-find debian ! -perm -200 -print -exec chmod +w {} \;
 ifneq ($(with_tk),yes)
-	rm -f $(d_base)/$(scriptdir)/lib-dynload/_tkinter.so
+	rm -f $(d_lbase)/$(scriptdir)/lib-dynload/_tkinter.$(DEB_HOST_MULTIARCH).so
 endif
 ifneq ($(with_gdbm),yes)
-	rm -f $(d_base)/$(scriptdir)/lib-dynload/gdbm.so
+	rm -f $(d_lbase)/$(scriptdir)/lib-dynload/gdbm.$(DEB_HOST_MULTIARCH).so
 endif
 	dh_strip -a -N$(p_dbg) -Xdebug -Xdbg --dbg-package=$(p_dbg)
 	cp Tools/gdb/libpython.py $(d_dbg)/usr/lib/debug/usr/bin/$(PVER)-gdb.py
@@ -1070,11 +1155,11 @@
 	done
 
 	dh_makeshlibs -p$(p_lib) -V '$(p_lib)'
-	dh_makeshlibs -p$(p_dbg) -V '$(p_dbg)'
+	dh_makeshlibs -p$(p_ldbg) -V '$(p_ldbg)'
 # don't include the following symbols, found in extensions
 # which either can be built as builtin or extension.
 	sed -ri '/^ (_check_|asdl_|fast_save_|init)/d' \
-	  $(d_lib)/DEBIAN/symbols $(d_dbg)/DEBIAN/symbols
+	  $(d_lib)/DEBIAN/symbols $(d_ldbg)/DEBIAN/symbols
 	dh_installdeb -a
 	dh_shlibdeps -a
 	dh_gencontrol -a
diff -u python2.7-2.7.3/debian/control.in python2.7-2.7.3/debian/control.in
--- python2.7-2.7.3/debian/control.in
+++ python2.7-2.7.3/debian/control.in
@@ -6,7 +6,7 @@
   libreadline-dev, libtinfo-dev, libncursesw5-dev (>= 5.3),
   tk8.5-dev, blt-dev (>= 2.4z), libssl-dev,
   zlib1g-dev, libbz2-dev,
-  libexpat1-dev (>= 2.1),
+  libexpat1-dev,
   libbluetooth-dev [linux-any],
   locales [!armel !avr32 !hppa !ia64 !mipsel],
   libsqlite3-dev, libffi-dev (>= 3.0.5),
@@ -23,36 +23,67 @@
 Package: @PVER@
 Architecture: any
 Priority: @PRIO@
-Depends: @PVER@-minimal (= ${binary:Version}), mime-support, ${shlibs:Depends}, ${misc:Depends}
+Depends: @PVER@-minimal (= ${binary:Version}), lib@PVER@-stdlib (= ${binary:Version}), mime-support, ${shlibs:Depends}, ${misc:Depends}
 Suggests: @PVER@-doc, binutils
-Provides: @PVER@-cjkcodecs, @PVER@-ctypes, @PVER@-elementtree, @PVER@-celementtree, @PVER@-wsgiref, @PVER@-profiler, @PVER@-argparse, python-argparse
 Conflicts: python-profiler (<= 2.7.1-2)
 Breaks: python-virtualenv (<< 1.7.1.2-2~), vim-nox (<< 2:7.3.547-4), vim-gtk (<< 2:7.3.547-4), vim-gnome (<< 2:7.3.547-4), vim-athena (<< 2:7.3.547-4)
 Replaces: python-profiler (<= 2.7.1-2)
+Multi-Arch: foreign
+Description: Interactive high-level object-oriented language (version @VER@)
+ Version @VER@ of the high-level, interactive object oriented language,
+ includes an extensive class library with lots of goodies for
+ network programming, system administration, sounds and graphics.
+
+Package: lib@PVER@-stdlib
+Architecture: any
+Multi-Arch: same
+Priority: @PRIO@
+Depends: lib@PVER@-minimal (= ${binary:Version}), mime-support, ${shlibs:Depends}, ${misc:Depends}
+Suggests: @PVER@-profiler
+Provides: @PVER@-cjkcodecs, @PVER@-ctypes, @PVER@-elementtree, @PVER@-celementtree, @PVER@-wsgiref, @PVER@-profiler, @PVER@-argparse, python-argparse
+Replaces: @PVER@ (<< 2.7.3-6)
 Description: Interactive high-level object-oriented language (version @VER@)
  Version @VER@ of the high-level, interactive object oriented language,
  includes an extensive class library with lots of goodies for
  network programming, system administration, sounds and graphics.
+ .
+ This package contains the standard library. It is normally not
+ used on it's own, but as a dependency of @PVER@.
 
 Package: @PVER@-minimal
 Architecture: any
 Priority: @MINPRIO@
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: lib@PVER@-minimal (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Recommends: @PVER@
 Suggests: binfmt-support
 Replaces: @PVER@ (<< 2.7.1~rc1-2~)
 Conflicts: binfmt-support (<< 1.1.2)
+Multi-Arch: foreign
 Description: Minimal subset of the Python language (version @VER@)
  This package contains the interpreter and some essential modules.  It can
  be used in the boot process for some basic tasks.
  See /usr/share/doc/@PVER@-minimal/README.Debian for a list of the modules
  contained in this package.
 
+Package: lib@PVER@-minimal
+Architecture: any
+Multi-Arch: same
+Priority: @MINPRIO@
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: lib@PVER@-stdlib
+Replaces: @PVER@ (<< 2.7.1~rc1-2~), @PVER@-minimal (<< 2.7.3-6)
+Conflicts: binfmt-support (<< 1.1.2)
+Description: Minimal subset of the Python language (version @VER@)
+ This package contains some essential modules. It is normally not
+ used on it's own, but as a dependency of @PVER@-minimal.
+
 Package: lib@PVER@
 Architecture: any
+Multi-Arch: same
 Section: libs
-Priority: optional
-Depends: @PVER@ (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Priority: @PRIO@
+Pre-Depends: multiarch-support
+Depends: lib@PVER@-stdlib (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Replaces: @PVER@ (<< 2.6)
 Description: Shared Python runtime library (version @VER@)
  Version @VER@ of the high-level, interactive object oriented language,
@@ -71,7 +102,7 @@
 
 Package: @PVER@-dev
 Architecture: any
-Depends: @PVER@ (= ${binary:Version}), lib@PVER@ (= ${binary:Version}), libexpat1-dev, libssl-dev, ${shlibs:Depends}, ${misc:Depends}
+Depends: @PVER@ (= ${binary:Version}), lib@PVER@-dev (= ${binary:Version}), lib@PVER@ (= ${binary:Version}), libexpat1-dev, libssl-dev, ${shlibs:Depends}, ${misc:Depends}
 Recommends: libc6-dev | libc-dev
 Replaces: @PVER@ (<< 2.7-3)
 Description: Header files and a static library for Python (v@VER@)
@@ -81,6 +112,24 @@
  .
  Maintainers of Python packages should read README.maintainers.
 
+Package: lib@PVER@-dev
+Section: libdevel
+Architecture: any
+Multi-Arch: same
+Pre-Depends: multiarch-support
+Depends: lib@PVER@-stdlib (= ${binary:Version}), lib@PVER@ (= ${binary:Version}), libssl-dev, libexpat1-dev, ${shlibs:Depends}, ${misc:Depends}
+Replaces: @PVER@ (<< 2.7-3), @PVER@-dev (<< 2.7.3-6), @PVER@-minimal (<< 2.7.3-6)
+Recommends: libc6-dev | libc-dev
+Description: Header files and a static library for Python (v@VER@)
+ Header files, a static library and development tools for building
+ Python (v@VER@) modules, extending the Python interpreter or embedding
+ Python (v@VER@) in applications.
+ .
+ Maintainers of Python packages should read README.maintainers.
+ .
+ This package contains development files. It is normally not
+ used on it's own, but as a dependency of @PVER@-dev.
+
 Package: idle-@PVER@
 Architecture: all
 Depends: @PVER@, python-tk (>= 2.6~a3), @PVER@-tk, ${misc:Depends}
@@ -118,5 +167,23 @@
-Depends: @PVER@ (>= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Depends: @PVER@ (= ${binary:Version}), lib@PVER@-dbg (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Suggests: python-gdbm-dbg, python-tk-dbg
+Multi-Arch: foreign
 Description: Debug Build of the Python Interpreter (version @VER@)
  Python interpreter configured with --pydebug. Dynamically loaded modules are
  searched in /usr/lib/@PVER@/lib-dynload/debug first.
+
+Package: lib@PVER@-dbg
+Section: debug
+Architecture: any
+Multi-Arch: same
+Priority: extra
+Pre-Depends: multiarch-support
+Depends: lib@PVER@-stdlib (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}, python
+Suggests: @PVER@-gdbm-dbg, @PVER@-tk-dbg
+Replaces: @PVER@-dbg (<< 2.7.3-6)
+Description: Debug Build of the Python Interpreter (version @VER@)
+ Python interpreter configured with --pydebug. Dynamically loaded modules are
+ searched in /usr/lib/@PVER@/lib-dynload/debug first.
+ .
+ This package contains the library for the debug interpreter. It is normally
+ not used on it's own, but as a dependency of @PVER@.
+
diff -u python2.7-2.7.3/debian/changelog python2.7-2.7.3/debian/changelog
--- python2.7-2.7.3/debian/changelog
+++ python2.7-2.7.3/debian/changelog
@@ -1,3 +1,16 @@
+python2.7 (2.7.3-6linaro3) precise; urgency=low
+
+  * Fix issues reported by Jakub Wilk
+
+ -- Riku Voipio <riku.voi...@linaro.org>  Fri, 14 Sep 2012 13:30:27 +0000
+
+python2.7 (2.7.3-6linaro2) precise; urgency=low
+
+  * Backport python Multiarch changes from 3.3 packaging
+    - Thanks to Mathias Klose and Wookey
+
+ -- Riku Voipio <riku.voi...@linaro.org>  Tue, 11 Sep 2012 13:00:14 +0000
+
 python2.7 (2.7.3-5) unstable; urgency=low
 
   * Enable verbose build for the sharedmods target.
diff -u python2.7-2.7.3/debian/patches/series.in python2.7-2.7.3/debian/patches/series.in
--- python2.7-2.7.3/debian/patches/series.in
+++ python2.7-2.7.3/debian/patches/series.in
@@ -69,0 +70 @@
+multiarch.diff
only in patch2:
unchanged:
--- python2.7-2.7.3.orig/debian/libPVER-dbg.symbols.in
+++ python2.7-2.7.3/debian/libPVER-dbg.symbols.in
@@ -0,0 +1,38 @@
+libpython@v...@dm.so.1.0 libpython@VER@-dbg #MINVER#
+#include "libpython.symbols"
+ _PyDict_Dummy@Base @VER@
+ _PyMem_DebugFree@Base @VER@
+ _PyMem_DebugMalloc@Base @VER@
+ _PyMem_DebugRealloc@Base @VER@
+ _PyObject_DebugCheckAddress@Base @VER@
+ _PyObject_DebugCheckAddressApi@Base @VER@
+ _PyObject_DebugDumpAddress@Base @VER@
+ _PyObject_DebugFree@Base @VER@
+ _PyObject_DebugFreeApi@Base @VER@
+ _PyObject_DebugMalloc@Base @VER@
+ _PyObject_DebugMallocApi@Base @VER@
+ _PyObject_DebugMallocStats@Base @VER@
+ _PyObject_DebugRealloc@Base @VER@
+ _PyObject_DebugReallocApi@Base @VER@
+ _PySet_Dummy@Base @VER@
+ _PyUnicode_CheckConsistency@Base @VER@
+ _PyUnicode_Dump@Base @VER@
+ _PyUnicode_compact_data@Base @VER@
+ _PyUnicode_data@Base @VER@
+ _PyUnicode_utf8@Base @VER@
+ _Py_AddToAllObjects@Base @VER@
+ _Py_Dealloc@Base @VER@
+ _Py_ForgetReference@Base @VER@
+ _Py_GetObjects@Base @VER@
+ _Py_GetRefTotal@Base @VER@
+ _Py_HashSecret_Initialized@Base @VER@
+ _Py_NegativeRefcount@Base @VER@
+ _Py_NewReference@Base @VER@
+ _Py_PrintReferenceAddresses@Base @VER@
+ _Py_PrintReferences@Base @VER@
+ _Py_RefTotal@Base @VER@
+ _Py_dumptree@Base @VER@
+ _Py_printtree@Base @VER@
+ _Py_showtree@Base @VER@
+ _Py_tok_dump@Base @VER@
+ PyModule_Create2TraceRefs@Base @VER@
only in patch2:
unchanged:
--- python2.7-2.7.3.orig/debian/libPVER-stdlib.overrides.in
+++ python2.7-2.7.3/debian/libPVER-stdlib.overrides.in
@@ -0,0 +1,12 @@
+# idlelib images
+lib@PVER@-stdlib binary: image-file-in-usr-lib
+
+# license file referred by the standard library
+lib@PVER@-stdlib binary: extra-license-file
+
+# template files
+lib@PVER@-stdlib binary: interpreter-not-absolute usr/lib/python3.3/venv/scripts/posix/pydoc #!__VENV_PYTHON__
+lib@PVER@-stdlib binary: unusual-interpreter usr/lib/python3.3/venv/scripts/posix/pydoc #!__VENV_PYTHON__
+
+# the split is the reason for that
+lib@PVER@-stdlib binary: python-script-but-no-python-dep
only in patch2:
unchanged:
--- python2.7-2.7.3.orig/debian/libPVER-dev.overrides.in
+++ python2.7-2.7.3/debian/libPVER-dev.overrides.in
@@ -0,0 +1 @@
+lib@PVER@-dev binary: python-script-but-no-python-dep
only in patch2:
unchanged:
--- python2.7-2.7.3.orig/debian/libPVER-minimal.postinst.in
+++ python2.7-2.7.3/debian/libPVER-minimal.postinst.in
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+set -e
+
+if [ ! -f /etc/@PVER@/sitecustomize.py ]; then
+    cat <<-EOF
+	# Empty sitecustomize.py to avoid a dangling symlink
+EOF
+fi
+
+#DEBHELPER#
+
+exit 0
only in patch2:
unchanged:
--- python2.7-2.7.3.orig/debian/libPVER-minimal.overrides.in
+++ python2.7-2.7.3/debian/libPVER-minimal.overrides.in
@@ -0,0 +1 @@
+lib@PVER@-minimal binary: python-script-but-no-python-dep
only in patch2:
unchanged:
--- python2.7-2.7.3.orig/debian/patches/multiarch.diff
+++ python2.7-2.7.3/debian/patches/multiarch.diff
@@ -0,0 +1,126 @@
+Index: python2.7-2.7.3/Lib/sysconfig.py
+===================================================================
+--- python2.7-2.7.3.orig/Lib/sysconfig.py	2012-09-14 11:47:47.240247891 +0000
++++ python2.7-2.7.3/Lib/sysconfig.py	2012-09-14 11:47:50.296207635 +0000
+@@ -12,7 +12,7 @@
+         'purelib': '{base}/lib/python{py_version_short}/site-packages',
+         'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
+         'include': '{base}/include/python{py_version_short}',
+-        'platinclude': '{platbase}/include/python{py_version_short}',
++        'platinclude': '{platbase}/include{multiarchsubdir}/python{py_version_short}',
+         'scripts': '{base}/bin',
+         'data': '{base}',
+         },
+@@ -494,6 +494,12 @@
+         # the init-function.
+         _CONFIG_VARS['userbase'] = _getuserbase()
+ 
++        multiarch = get_config_var('MULTIARCH')
++        if multiarch:
++            _CONFIG_VARS['multiarchsubdir'] = '/' + multiarch
++        else:
++            _CONFIG_VARS['multiarchsubdir'] = ''
++
+         if 'srcdir' not in _CONFIG_VARS:
+             _CONFIG_VARS['srcdir'] = _PROJECT_BASE
+ 
+Index: python2.7-2.7.3/Makefile.pre.in
+===================================================================
+--- python2.7-2.7.3.orig/Makefile.pre.in	2012-09-14 11:47:47.240247891 +0000
++++ python2.7-2.7.3/Makefile.pre.in	2012-09-14 11:47:50.296207635 +0000
+@@ -88,6 +88,9 @@
+ # Machine-dependent subdirectories
+ MACHDEP=	@MACHDEP@
+ 
++# Multiarch directory (may be empty)
++MULTIARCH=	@MULTIARCH@
++
+ # Install prefix for architecture-independent files
+ prefix=		@prefix@
+ 
+@@ -102,7 +105,7 @@
+ LIBDIR=		@libdir@
+ MANDIR=		@mandir@
+ INCLUDEDIR=	@includedir@
+-CONFINCLUDEDIR=	$(exec_prefix)/include
++CONFINCLUDEDIR=	$(exec_prefix)/include/$(MULTIARCH)
+ SCRIPTDIR=	$(prefix)/lib
+ 
+ # Detailed destination directories
+@@ -557,6 +560,10 @@
+ Modules/python.o: $(srcdir)/Modules/python.c
+ 	$(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Modules/python.c
+ 
++Python/dynload_shlib.o: $(srcdir)/Python/dynload_shlib.c Makefile
++	$(CC) -c $(PY_CORE_CFLAGS) \
++		$(if $(MULTIARCH),-DMULTIARCH='"$(MULTIARCH)"') \
++		-o $@ $(srcdir)/Python/dynload_shlib.c
+ 
+ # Use a stamp file to prevent make -j invoking pgen twice
+ $(GRAMMAR_H) $(GRAMMAR_C): Parser/pgen.stamp
+@@ -865,7 +872,7 @@
+ 		$(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
+ 
+ # Install the library
+-PLATDIR=	plat-$(MACHDEP)
++PLATDIR=	plat-$(MULTIARCH)
+ EXTRAPLATDIR= @EXTRAPLATDIR@
+ EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
+ MACHDEPS=	$(PLATDIR) $(EXTRAPLATDIR)
+@@ -1013,10 +1020,10 @@
+ 
+ # Install the library and miscellaneous stuff needed for extending/embedding
+ # This goes into $(exec_prefix)$(DEBUG_EXT)
+-LIBPL=		$(LIBP)/config$(DEBUG_EXT)
++LIBPL=		$(LIBP)/config-$(MULTIARCH)$(DEBUG_EXT)
+ 
+ # pkgconfig directory
+-LIBPC=		$(LIBDIR)/pkgconfig
++LIBPC=		$(LIBDIR)/$(MULTIARCH)/pkgconfig
+ 
+ libainstall:	all python-config
+ 	@for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
+Index: python2.7-2.7.3/Modules/Setup.dist
+===================================================================
+--- python2.7-2.7.3.orig/Modules/Setup.dist	2012-09-14 11:47:47.240247891 +0000
++++ python2.7-2.7.3/Modules/Setup.dist	2012-09-14 11:47:50.296207635 +0000
+@@ -91,7 +91,7 @@
+ TESTPATH=
+ 
+ # Path components for machine- or system-dependent modules and shared libraries
+-MACHDEPPATH=:plat-$(MACHDEP)
++MACHDEPPATH=:plat-$(MULTIARCH)
+ EXTRAMACHDEPPATH=
+ 
+ # Path component for the Tkinter-related modules
+Index: python2.7-2.7.3/Python/dynload_shlib.c
+===================================================================
+--- python2.7-2.7.3.orig/Python/dynload_shlib.c	2012-09-14 11:47:47.240247891 +0000
++++ python2.7-2.7.3/Python/dynload_shlib.c	2012-09-14 11:48:23.487770635 +0000
+@@ -49,6 +49,12 @@
+ #ifdef Py_DEBUG
+     {"_d.so", "rb", C_EXTENSION},
+     {"module_d.so", "rb", C_EXTENSION},
++# ifdef MULTIARCH
++    {"." MULTIARCH "_d.so", "rb", C_EXTENSION},
++# endif
++#endif
++#ifdef MULTIARCH
++    {"." MULTIARCH ".so", "rb", C_EXTENSION},
+ #endif
+     {".so", "rb", C_EXTENSION},
+     {"module.so", "rb", C_EXTENSION},
+Index: python2.7-2.7.3/configure.ac
+===================================================================
+--- python2.7-2.7.3.orig/configure.ac	2012-09-14 11:47:47.240247891 +0000
++++ python2.7-2.7.3/configure.ac	2012-09-14 11:47:50.300207582 +0000
+@@ -12,6 +12,9 @@
+ AC_CONFIG_SRCDIR([Include/object.h])
+ AC_CONFIG_HEADER(pyconfig.h)
+ 
++MULTIARCH=$(gcc --print-multiarch 2>/dev/null)
++AC_SUBST(MULTIARCH)
++
+ dnl Ensure that if prefix is specified, it does not end in a slash. If
+ dnl it does, we get path names containing '//' which is both ugly and
+ dnl can cause trouble.

Reply via email to