[issue1322] platform.dist() has unpredictable result under Linux

Marc-Andre Lemburg report at bugs.python.org
Tue Sep 23 22:05:24 CEST 2008


Marc-Andre Lemburg <mal at egenix.com> added the comment:

On 2008-09-23 21:49, Zooko O'Whielacronx wrote:
> Zooko O'Whielacronx <zooko at zooko.com> added the comment:
> 
> MAL:  why do you say it is better to look for
> /etc/$supportedplatform-release files first instead of looking for
> /etc/lsb-release first?

Because that's exactly what lsb_release does as well. The data
in /etc/lsb-release can only override data already parsed from
the /etc/<distro>-release file.

> I do not know if /etc/lsb-release is suitably generic -- I've tried it
> only on a few platforms.  I do know that executing lsb_release is
> suitably generic since it is standard, but I prefer not to try it first
> since it imposes about half-a-second delay.

lsb_release is standard on LSB compliant Linuxes, but the much
older /etc/<distro>-release file approach is still valid and in
wide use.

E.g. on SuSE, /etc/lsb-release doesn't contain any usable
distribution information. On Fedora, that file doesn't exist at
all.

It's better to follow the approach taken by lsb_release and then
add calling lsb_release as one of the methods taken by
_dist_try_harder() (using platform.popen()) should the parsers
fail.

This avoids spawning a process in most cases.

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


More information about the Python-bugs-list mailing list