Package: python2.7 Version: 2.7.3~rc2-2.1 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._architecture`. A similar patch will be made available for Python 3.3, except that there, it will be avialable under `sys.implementation._architecture` as per PEP 421. 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 Versions of packages python2.7 depends on: ii libbz2-1.0 1.0.6-4 ii libc6 2.13-37 ii libdb5.1 5.1.29-5 ii libexpat1 2.1.0-1 ii libgcc1 1:4.7.2-4 ii libncursesw5 5.9-10 ii libreadline6 6.2-8 ii libsqlite3-0 3.7.13-1 ii libtinfo5 5.9-10 ii mime-support 3.52-1 ii python2.7-minimal 2.7.3~rc2-2.1 python2.7 recommends no packages. Versions of packages python2.7 suggests: ii binutils 2.22-7.1 pn python2.7-doc <none> - -- no debconf information -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIbBAEBCAAGBQJQy5pQAAoJEBJutWOnSwa/e1QP91RxE/xWAUKQvSM08BEZsmW6 J7NEgCOz5GNIM2nG2VxTL2L2s3dxNNODhMi9r35RrmgSeTkkiUmMiqpL5hKPiVMs 5bjIA/GHYfdZp3wt52qBA2KckvW9D0257QoMs+d5j0lHs/syijTPLGvg9qAJx70L 4SsjZSCnJ4aKpYvu8je8RKc2lzmsLBuY6NuIoIRbee0KhZoXwXwb0y0JNpUj7r2T QlCiM9dh8OS2vMtiRmL27/jT1HWLnoT3tkBzkP/eaYP+wyhwbIsQ8q9Ltk5PtzMV gX/N7sy8QnetNopILxAhmK+h0O9OoH5Is4WrF8USsAJeb8TWLmxOjTTlDmHGyIde xOqj7hlhzc+uNzR/jB09j7Uszj7J0i0hunJadGCmCTk/OunY5Y+IKHBA78+JSNVI hF8j81p6iTg1BNzrcrKAwzbkXFWD/bUgK85xBP1wdtm6srIKVyBfSw5eqiuAVfgw SwLyhiqZPz+UeFXaSKgOGAYLW+do5qZdaQ64CbXTAjm5P/hZR7+xwfA0cnla9RT5 ZclZnHojln9uw/9i1mTMZ+278hnIbTzfzxRkmaNUmKN7VV0gDry9ltlUJtHsGb3C Kn/jYSVsnSqCV06qm2x4Gei5sPqlVN/TpuvEssf5ZnK40mSVMKvTDnit9Gvmh/yU viPWNZdWPBrqaSJ2gAc= =2fr2 -----END PGP SIGNATURE-----
=== modified file 'debian/changelog' --- debian/changelog 2012-12-10 19:10:32 +0000 +++ debian/changelog 2012-12-14 20:24:32 +0000 @@ -1,3 +1,10 @@ +python2.7 (2.7.3-13) 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:23:02 -0500 + python2.7 (2.7.3-12) experimental; urgency=low * Fix typo in pkgconfig file. Closes: #695671, LP: #1088988. === modified file 'debian/patches/series.in' --- debian/patches/series.in 2012-12-10 16:06:41 +0000 +++ debian/patches/series.in 2012-12-14 20:24:32 +0000 @@ -66,3 +66,4 @@ lib2to3-no-pickled-grammar.diff add-python-config-sh.diff ssl.match_hostname.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:24:32 +0000 @@ -0,0 +1,60 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -24,6 +24,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 +@@ -40,6 +40,7 @@ + HGVERSION= @HGVERSION@ + HGTAG= @HGTAG@ + HGBRANCH= @HGBRANCH@ ++MULTIARCH_BUILD= @MULTIARCH_BUILD@ + + GNULD= @GNULD@ + +@@ -1304,6 +1305,11 @@ + + Python/thread.o: @THREADHEADERS@ + ++Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile ++ $(CC) -c $(PY_CORE_CFLAGS) \ ++ -DMULTIARCH_BUILD="\"`LC_ALL=C $(MULTIARCH_BUILD)`\"" \ ++ -o $@ $(srcdir)/Python/sysmodule.c ++ + # Declare targets that aren't real files + .PHONY: all build_all sharedmods oldsharedmods test quicktest memtest + .PHONY: install altinstall oldsharedinstall bininstall altbininstall +--- a/Python/sysmodule.c ++++ b/Python/sysmodule.c +@@ -1435,6 +1435,8 @@ + PyFloat_GetInfo()); + SET_SYS_FROM_STRING("long_info", + PyLong_GetInfo()); ++ SET_SYS_FROM_STRING("_architecture", ++ PyString_FromString(MULTIARCH_BUILD)); + #ifdef Py_USING_UNICODE + SET_SYS_FROM_STRING("maxunicode", + PyInt_FromLong(PyUnicode_GetMax()));