Message56710
The distribution name returned by platform.dist() depends on the order
of os.path.listdir( '/etc' ). It selects the first file matching the
regex r'(\w+)[-_](release|version)' and takes part of the file name
(i.e. matchResult.groups()[0]) as distribution name. But there are often
several files matching this pattern (at least on Fedora and Mandriva).
For instance, on a Mandriva 2007.1 official, I can see the following files:
[login@localhost ~]$ ls -l /etc/*-release
-rw-r--r-- 1 root root 137 jan 18 2007 /etc/lsb-release
lrwxrwxrwx 1 root root 16 oct 7 17:32 /etc/mandrakelinux-release ->
mandriva-r
elease
lrwxrwxrwx 1 root root 16 oct 7 17:32 /etc/mandrake-release ->
mandriva-releas
e
-rw-r--r-- 1 root root 50 avr 2 2007 /etc/mandriva-release
lrwxrwxrwx 1 root root 16 oct 7 17:32 /etc/redhat-release ->
mandriva-release
Therefore, the result for platform.distrib()[0] could be mandriva,
mandrake, redhat or even lsb. The first match wins !
Ignoring symlinks could remove part of the problem. On Mandriva, it
would leave only lsb-release and mandriva-release. It is possible to
select the good one by ignoring lsb-release or by verifying the file's
content (mandriva-release has one line and lsb-release has several
lines). I do not know if the second method is portable. |
|
Date |
User |
Action |
Args |
2007-10-24 17:21:04 | sapetnioc | set | spambayes_score: 0.0909411 -> 0.09094109 recipients:
+ sapetnioc |
2007-10-24 17:21:04 | sapetnioc | set | spambayes_score: 0.0909411 -> 0.0909411 messageid: <1193246464.1.0.269134020057.issue1322@psf.upfronthosting.co.za> |
2007-10-24 17:21:04 | sapetnioc | link | issue1322 messages |
2007-10-24 17:21:03 | sapetnioc | create | |
|