Re: Distinguishing Debian and Fedora

Sanjeev Gupta <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.devel
Message-ID <CAHZk5WfC8O-LVtoWtUXqU+S8Xb+MV1JzcjjJEBTN22+-ZP3ZJw@mail.gmail.com>
On Tue, Jan 19, 2016 at 7:42 PM, Russel Winder <[email protected]> wrote:

> def which_posix():
>     with open('/etc/os-release') as f:
>         for line in f:
>             if 'ID' in line:
>                 return {
>                     'debian': OS_Type.linux_debian,
>                     'fedora': OS_Type.linux_fedora,
>                     }[line.split('=')[1].strip()]
>         return OS_Type.posix
>

On an Ubuntu machine, /etc/os-release is:

sanjeev@X201wily:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04 (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
UBUNTU_CODENAME=xenial
sanjeev@X201wily:~$


-- 
Sanjeev Gupta
+65 98551208     http://www.linkedin.com/in/ghane

_______________________________________________
Scons-dev mailing list
[email protected]
https://pairlist2.pair.net/mailman/listinfo/scons-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.