On Dec 19, 2012, at 11:57 PM, Matthias Klose wrote: >hard-coding gcc is wrong. you should use CC and have this code at a position >where it's clear which CC to use. > >if this patch is debian local, you can drop the dpkg-architecture check.
This is actually much simpler than I first though. We already have a patch to calculate `gcc -print-multiarch` in configure.ac and it's already stashed in the MULTIARCH autoconf variable. So really, all my patch needs to do is to expose that in the sys module. >_architecture is a bad name. just name it _multiarch, or obfuscate it even >more (a name longer than single_version_externally_managed would be >preferred). sys.implementation._multiarch is fine. >Make sure that the tuple ends up in _sysconfigdata.py with a >sensible name, e.g. HOST_MULTIARCH. The latter one can be overwritten for >cross builds (once the 3.3 cross build changes are backported), and should be >the preferred way to access this information. It's already there :) $ python3.3 -c "import _sysconfigdata; print(_sysconfigdata.build_time_vars['MULTIARCH'])" x86_64-linux-gnu $ python2.7 -c "import _sysconfigdata; print(_sysconfigdata.build_time_vars['MULTIARCH'])" x86_64-linux-gnu Updated patch attached.
=== modified file 'debian/changelog' --- debian/changelog 2012-12-10 19:10:32 +0000 +++ debian/changelog 2012-12-20 15:10:49 +0000 @@ -1,3 +1,10 @@ +python2.7 (2.7.3-13) experimental; urgency=low + + * debian/patches/sys-multiarch.diff: Expose multiarch triplet as + sys._multiarch. Closes: #695958 + + -- Barry Warsaw <ba...@python.org> Thu, 20 Dec 2012 08:53:42 -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-20 15:10:49 +0000 @@ -66,3 +66,4 @@ lib2to3-no-pickled-grammar.diff add-python-config-sh.diff ssl.match_hostname.diff +sys-multiarch.diff === added file 'debian/patches/sys-multiarch.diff' --- debian/patches/sys-multiarch.diff 1970-01-01 00:00:00 +0000 +++ debian/patches/sys-multiarch.diff 2012-12-20 15:10:49 +0000 @@ -0,0 +1,25 @@ +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1304,6 +1304,11 @@ + + Python/thread.o: @THREADHEADERS@ + ++Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile ++ $(CC) -c $(PY_CORE_CFLAGS) \ ++ -DMULTIARCH='"$(MULTIARCH)"' \ ++ -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("_multiarch", ++ PyString_FromString(MULTIARCH)); + #ifdef Py_USING_UNICODE + SET_SYS_FROM_STRING("maxunicode", + PyInt_FromLong(PyUnicode_GetMax()));
=== modified file 'debian/changelog' --- debian/changelog 2012-12-10 19:10:32 +0000 +++ debian/changelog 2012-12-20 15:10:49 +0000 @@ -1,3 +1,10 @@ +python2.7 (2.7.3-13) experimental; urgency=low + + * debian/patches/sys-multiarch.diff: Expose multiarch triplet as + sys._multiarch. Closes: #695958 + + -- Barry Warsaw <ba...@python.org> Thu, 20 Dec 2012 08:53:42 -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-20 15:10:49 +0000 @@ -66,3 +66,4 @@ lib2to3-no-pickled-grammar.diff add-python-config-sh.diff ssl.match_hostname.diff +sys-multiarch.diff === added file 'debian/patches/sys-multiarch.diff' --- debian/patches/sys-multiarch.diff 1970-01-01 00:00:00 +0000 +++ debian/patches/sys-multiarch.diff 2012-12-20 15:10:49 +0000 @@ -0,0 +1,25 @@ +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1304,6 +1304,11 @@ + + Python/thread.o: @THREADHEADERS@ + ++Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile ++ $(CC) -c $(PY_CORE_CFLAGS) \ ++ -DMULTIARCH='"$(MULTIARCH)"' \ ++ -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("_multiarch", ++ PyString_FromString(MULTIARCH)); + #ifdef Py_USING_UNICODE + SET_SYS_FROM_STRING("maxunicode", + PyInt_FromLong(PyUnicode_GetMax()));
signature.asc
Description: PGP signature