[issue12326] Linux 3: code should avoid using sys.platform == 'linux2'

Barry A. Warsaw report at bugs.python.org
Tue Aug 16 16:21:05 CEST 2011


Barry A. Warsaw <barry at python.org> added the comment:

@Sandro:

>> FTR, for Debian and derivatives, doko chose to use 'linux2' when building on linux3.

>Luckily that has just been reverted.

No, I don't think it has: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=633015

On Debian Wheezy and Ubuntu 11.10:

$ python2.7 -c 'import sys; print sys.platform'
linux2
$ python3.2 -c 'import sys; print(sys.platform)'
linux2

oneiric$ uname -a
Linux resist 3.0.0-8-generic #11-Ubuntu SMP Fri Aug 12 20:23:58 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
wheezy$ uname -a
Linux chemistry 3.0.0-1-amd64 #1 SMP Sun Jul 24 02:24:44 UTC 2011 x86_64 GNU/Linux

I agree with MvL that Python 3.3 should set sys.platform to 'linux' and all stable releases should be patched to return 'linux2' on MACHDEP='linux3' systems.  configure.in already special cases cygwin* and darwin* to the major-version-number-less platform string, so this doesn't seem like much of a stretch to me for linux.  Since applications/libraries that already test against literal sys.platform values will be broken no matter what we do (except perhaps retain 'linux2' for perpetuity, which doesn't seem like a good idea), I think we should make a clean break from the major version number in Python 3.3 and keep backward compatibility for released Pythons.  Seems like the least worst option to me.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12326>
_______________________________________


More information about the Python-bugs-list mailing list