This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients lemburg, neologix, pitrou, rosslagerwall, vstinner
Date 2011-05-23.13:02:56
SpamBayes Score 1.4508663e-09
Marked as misclassified No
Message-id <4DDA5AFC.6000005@egenix.com>
In-reply-to <1306153526.98.0.695363771693.issue12158@psf.upfronthosting.co.za>
Content
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/
History
Date User Action Args
2011-05-23 13:02:57lemburgsetrecipients: + lemburg, pitrou, vstinner, neologix, rosslagerwall
2011-05-23 13:02:56lemburglinkissue12158 messages
2011-05-23 13:02:56lemburgcreate