Marc-Andre Lemburg <[email protected]> added the comment:
STINNER Victor wrote:
>
> New submission from STINNER Victor <[email protected]>:
>
> Sometimes, we need to know the version of the Linux kernel. Recent examples:
> test if SOCK_CLOEXEC or O_CLOEXEC are supported by the kernel or not. Linux <
> 2.6.23 *silently* ignores O_CLOEXEC flag of open().
>
> linux_version() is already implemented in test_socket, but it looks like
> test_posix does also need it.
>
> Attached patch adds platform.linux_version(). It returns (a, b, c) (integers)
> or None (if not Linux).
>
> It raises an error if the version string cannot be parsed.
The APIs in platform generally try not to raise errors, but instead
return a default value you pass in as parameter in case the
data cannot be fetched from the system.
The returned value should be a version string in a fixed
format, not a tuple. I'd suggest to use _norm_version()
for this.
Please also check whether this works on a few Linux systems.
I've checked it on openSUSE, Ubuntu.
Thanks,
--
Marc-Andre Lemburg
eGenix.com
________________________________________________________________________
2011-06-20: EuroPython 2011, Florence, Italy 28 days to go
::: Try our new mxODBC.Connect Python Database Interface for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
http://www.egenix.com/company/contact/
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue12158>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com