Finding out the OS distribution name

M.-A. Lemburg mal at lemburg.com
Thu Oct 21 12:04:04 EDT 1999


Markus Stenberg wrote:
> 
> "M.-A. Lemburg" <mal at lemburg.com> writes:
> > Is there a way to find out the name of the OS distribution a script is
> > running on ?
> 
> Short answer: No.
> 
> > E.g. I'd like a function that returns 'Redhat6.1'/'SuSE6.2' or
> > 'Win95'/'Win98'/'WinNT' or 'MacOS8'/'MacOS9' etc.
> 
> Longer answer: It is possible to guess, but not trivially [by either
> hugging filesystem tightly, or by TCP/IP fingerprinting]. And AFAIK there
> isn't such a module available for Python, anyhow.

Well that's good enough for me :-) Let's see...

On SuSE Linux there's a file /etc/SuSE-release which tells me the
version etc.

There must be similar things on other systems... e.g.
one could check command.com on WinXX and query the registry (forgot
the key though) to find out which version it is running. It's a pitty
that "uname" doesn't return this information.

I was thinking of something similar to the config.guess shell
script included in autoconf. A bit more simpleminded perhaps but
with enough information to be recognizable by a human :-) I would
like to include it in the mxCGIPython project (see my Python Pages)
which automatically generates a canonical name for the system
where the binary is being compiled on.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                    71 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/





More information about the Python-list mailing list