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

Charles-François Natali report at bugs.python.org
Tue Jul 19 19:52:09 CEST 2011


Charles-François Natali <neologix at free.fr> added the comment:

> I'm still in favor of keeping sys.platform == 'linux3', and you?
>

So do I.

> For plat-linux3, should we regenerate this directory (I cannot do that, I
> don't have Linux 3.0 yet) or can we just use a symbolic link? I read that
> Linux 3.0 doesn't break the API, so I suppose that constants are the same.
> Or can we try by copying plat-linux2 to plat-linux3?
>

I've just had a quick look, but it seems that plat-<sys.platform>
contains header definitions, so it's more function of the libc than
the kernel version. It probably makes sense on operating systems which
have a real notion of release (i.e. a consistent kernel/user-space,
like AIX or *BSD), but not so much on Linux. Copying plat-linux2 to
plat-linux3 should be just fine.

Your patch looks fine to me, except for this:
-        if (platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
-                        'freebsd7', 'freebsd8')
-            or platform.startswith("gnukfreebsd")):
+        if os.uname()[0] in ('Linux', 'FreeBSD'):

Why not use platform.system(), to be consistent?

----------

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


More information about the Python-bugs-list mailing list