[issue12158] platform: add linux_version()

2011-05-23 Thread Roundup Robot
Roundup Robot added the comment: New changeset d585a6d548a3 by Victor Stinner in branch 'default': Issue #12158: Move linux_version() from test_socket to test.support http://hg.python.org/cpython/rev/d585a6d548a3 -- nosy: +python-dev ___ Python track

[issue12158] platform: add linux_version()

2011-05-23 Thread Marc-Andre Lemburg
Changes by Marc-Andre Lemburg : -- resolution: -> rejected status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing

[issue12158] platform: add linux_version()

2011-05-23 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: STINNER Victor wrote: > > STINNER Victor added the comment: > >> You can then use linux_version().split('.') in code that want >> to do version comparisons. > > It doesn't give the expected result: > ('2', '6', '9') < ('2', '6', '20') > False

[issue12158] platform: add linux_version()

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: > You can then use linux_version().split('.') in code that want > to do version comparisons. It doesn't give the expected result: >>> ('2', '6', '9') < ('2', '6', '20') False >>> ('2', '6', '9') > ('2', '6', '20') True By the way, if you would like to *displa

[issue12158] platform: add linux_version()

2011-05-23 Thread Charles-François Natali
Charles-François Natali added the comment: Do we really need to expose a such Linux-centric and sparingly used function to the platform module? Since it's needed by several tests, why not add it to Lib/test/support.py? That way, we could also make it return a tuple without breaking any existing

[issue12158] platform: add linux_version()

2011-05-23 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: STINNER Victor wrote: > > STINNER Victor added the comment: > > Use "%s.%s.%s" % linux_version() if you would like to format the version. The > format is well defined. (You should only do that under Linux.) No, please follow the API conventions in that

[issue12158] platform: add linux_version()

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: Use "%s.%s.%s" % linux_version() if you would like to format the version. The format is well defined. (You should only do that under Linux.) -- ___ Python tracker ___

[issue12158] platform: add linux_version()

2011-05-23 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: STINNER Victor wrote: > > STINNER Victor added the comment: > >> The returned value should be a version string in a fixed format, >> not a tuple. I'd suggest to use _norm_version() for this. > > How do you compare version strings? I prefer tuples, as sys

[issue12158] platform: add linux_version()

2011-05-23 Thread STINNER Victor
STINNER Victor added the comment: > The returned value should be a version string in a fixed format, > not a tuple. I'd suggest to use _norm_version() for this. How do you compare version strings? I prefer tuples, as sys.version_info, because the comparaison is more natural: >>> '2.6.9' > '2.

[issue12158] platform: add linux_version()

2011-05-23 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: STINNER Victor wrote: > > New submission from STINNER Victor : > > 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_

[issue12158] platform: add linux_version()

2011-05-23 Thread Ross Lagerwall
Changes by Ross Lagerwall : -- nosy: +rosslagerwall ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail

[issue12158] platform: add linux_version()

2011-05-23 Thread STINNER Victor
New submission from STINNER Victor : 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_soc