Package: python3.3 Severity: normal -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Dear Maintainer, We have several cases where the multiarch triplet is needed for the proper building or functioning of other Python modules or applications. A recent example is virtualenv. In the debian-python mailing list, several solutions for the virtualenv problem have been discussed, but all of them are unsatisfying. What we really need is an officially approved, common way of getting the triplet, that doesn't require shelling out or globbing the file system. When Python is built, it already knows (or can easily find out) what the triplet should be, so it's best if we expose this in the sys module. Attached is a patch similar to one discussed on debian-python. It exposes the triplet as sys.implementation_architecture. A similar patch has been made available for Python 2.7, except that there, it will be avialable under sys._architecture. Bilingual Python code can use: >>> import sys >>> getattr(sys, 'implementation', sys)._architecture Cheers. - -- System Information: Debian Release: wheezy/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 3.2.0-4-amd64 (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBCAAGBQJQy56RAAoJEBJutWOnSwa/W3wP/ili/1kfbJu7sZvy2LjrgYPJ TXepiU7cp1Ezj5ZQFNMZf7vT9vguamuQfXSXuEaMbzuB22oKaGfdBmVjO9uWppxY 3SJ6Qm8WKM2xcRGmGHVKgwBD7lH1AnUIVSWwz0UMqw7Q6gc2SIYI8ESEYfCvLMRV WVscW9iUMxrzBqHT099PWe7DdCWPhckEnNL76L+uNXkco3HgwasYo+mO/oHCoAVB h67VbWdc2FBo3sbtcf8UQVmAfXeWL5ek1qw7QL2MCAxFR+0rdqj3zRa80+ZhP3Tu zsJqzTietpaS8mnM5fSzsW6yWGutsuBk958cxb4jlKN88U6rvQvM0I+duYzVmSIU gP4iG/F4I5yEN1J41Jpm6xYBOjmmGyHRoDcsnRl3r0bjNnY1JmgymOjnQvTqTYso 0dUR+Oddvd/2PoMr1xWHHstCI5QszbTutXVWMf/cSZPkcbyWuJOTR8p0UU1WzOsO TDmp2OoT/h6/VYuK/MQbEAZMm11A704M4P4rcC2ct045ao/2zRGVJ5cbbvrTbU69 Dy6HbkqeNMBmXsU9jHdyD20jhC9c/WSF3hEKXnMsddNWu6AyM1/4dOrT6UJ1ufxT Gw26A15YtS+ySAcSmwYwb6YcaLjSMyOFpH9x4qpWbTVWZLGqxRccHsqMcfPHOrrr ZQpXIbw85BsTZ29UCbfP =vxcp -----END PGP SIGNATURE-----
=== modified file 'debian/changelog' --- debian/changelog 2012-12-04 04:36:42 +0000 +++ debian/changelog 2012-12-14 20:52:07 +0000 @@ -1,3 +1,10 @@ +python3.3 (3.3.0-7) experimental; urgency=low + + * debian/patches/sys-implementation.diff: Expose multiarch triplet value + as sys._architecture. + + -- Barry Warsaw <ba...@python.org> Fri, 14 Dec 2012 15:50:45 -0500 + python3.3 (3.3.0-6) experimental; urgency=low * Don't use xattrs on kfreebsd and the Hurd. === modified file 'debian/patches/series.in' --- debian/patches/series.in 2012-12-04 04:36:42 +0000 +++ debian/patches/series.in 2012-12-14 20:52:07 +0000 @@ -54,3 +54,4 @@ ext-no-libpython-link.diff add-python-config-sh.diff kfreebsd-xattrs.diff +sys-implementation.diff === added file 'debian/patches/sys-implementation.diff' --- debian/patches/sys-implementation.diff 1970-01-01 00:00:00 +0000 +++ debian/patches/sys-implementation.diff 2012-12-14 20:52:07 +0000 @@ -0,0 +1,63 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -84,6 +84,24 @@ + prefix=`echo "$prefix" | sed -e 's/\/$//g'` + fi + ++dnl Debian multiarch support in sys.implementation._architecture ++dnl Try `dpkg-architecture -qDEB_BUILD_MULTIARCH` first, then ++dnl `gcc --print-multiarch`. ++AC_SUBST(MULTIARCH_BUILD) ++AC_CHECK_PROG(HAS_DPKG_ARCHITECTURE, dpkg-architecture, found, not-found) ++if test $HAS_DPKG_ARCHITECTURE = found ++then ++ MULTIARCH_BUILD="dpkg-architecture -qDEB_BUILD_MULTIARCH" ++else ++ AC_CHECK_PROG(HAS_GCC_FOR_ARCH, gcc, found, not-found) ++ if test $HAS_GCC_FOR_ARCH = found ++ then ++ MULTIARCH_BUILD="gcc --print-multiarch" ++ else ++ MULTIARCH_BUILD="" ++ fi ++fi ++ + dnl This is for stuff that absolutely must end up in pyconfig.h. + dnl Please use pyport.h instead, if possible. + AH_TOP([ +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -43,6 +43,7 @@ + HGVERSION= @HGVERSION@ + HGTAG= @HGTAG@ + HGBRANCH= @HGBRANCH@ ++MULTIARCH_BUILD= @MULTIARCH_BUILD@ + + GNULD= @GNULD@ + +@@ -647,6 +648,7 @@ + Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile + $(CC) -c $(PY_CORE_CFLAGS) \ + -DABIFLAGS='"$(ABIFLAGS)"' \ ++ -DMULTIARCH_BUILD="\"`LC_ALL=C $(MULTIARCH_BUILD)`\"" \ + -o $@ $(srcdir)/Python/sysmodule.c + + $(IO_OBJS): $(IO_H) +--- a/Python/sysmodule.c ++++ b/Python/sysmodule.c +@@ -1534,6 +1534,15 @@ + if (res < 0) + goto error; + ++ /* For Debian multiarch support. */ ++ value = PyUnicode_FromString(MULTIARCH_BUILD); ++ if (value == NULL) ++ goto error; ++ res = PyDict_SetItemString(impl_info, "_architecture", value); ++ Py_DECREF(value); ++ if (res < 0) ++ goto error; ++ + /* dict ready */ + + ns = _PyNamespace_New(impl_info);