Message136625
STINNER Victor wrote:
>
> New submission from STINNER Victor <victor.stinner@haypocalc.com>:
>
> 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/ |
|
Date |
User |
Action |
Args |
2011-05-23 13:02:57 | lemburg | set | recipients:
+ lemburg, pitrou, vstinner, neologix, rosslagerwall |
2011-05-23 13:02:56 | lemburg | link | issue12158 messages |
2011-05-23 13:02:56 | lemburg | create | |
|