[Scons-dev] Distinguishing Debian and Fedora

Sanjeev Gupta ghane0 at gmail.com
Tue Jan 19 08:27:20 EST 2016


On Tue, Jan 19, 2016 at 7:42 PM, Russel Winder <russel at winder.org.uk> 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 at 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 at X201wily:~$


-- 
Sanjeev Gupta
+65 98551208     http://www.linkedin.com/in/ghane
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20160119/a71337ae/attachment.html>


More information about the Scons-dev mailing list