getting linux distro used...

Sebastian Wiesner basti.wiesner at gmx.net
Mon Apr 27 12:22:27 CEST 2009


<Lawrence D'Oliveiro – Montag, 27. April 2009 10:07>

> In message <c7c38f62-1929-46da-
> a88b-2ded6f8aff9d at y33g2000prg.googlegroups.com>, deostroll wrote:
> 
>> I just found that you could use platform.system() to get the
>> underlying os used. But is there a way to get the distro used...?
> 
> Mostly the differences will not be important. But if you want to know, I
> have been compiling a list of tests here
> 
<http://codecodex.com/wiki/index.php?title=Identifying_the_OS_Distribution>.

At least the Gentoo-Test is not very reliable.  While "/usr/portage/" is the 
default location for the portage tree, it is not enforced, neither by 
portage nor by alternative package managers like paludis.  The portage tree 
as well as the distfiles can perfectly moved to another directory (I've done 
so).

Testing for the existing of "/usr/bin/emerge" or even better "/etc/gentoo-
release" seems more reliable to me.  The latter is also used by Python to 
implement "platform.dist()".

-- 
Freedom is always the freedom of dissenters.
                                      (Rosa Luxemburg)




More information about the Python-list mailing list