Fix Darwin and FreeBSD OS type detection

Obtained in part from http://reviews.llvm.org/D6290

llvm-svn: 222136
This commit is contained in:
Ed Maste 2014-11-17 15:40:18 +00:00
parent 0178e7587e
commit 9dfcaf4854
1 changed files with 11 additions and 8 deletions

View File

@ -28,9 +28,10 @@ import sys # Provide system information
#--
class EnumOsType( object ):
values = [ "Unknown",
"Windows",
"Darwin",
"FreeBSD",
"Linux",
"Darwin" ]; # OSX
"Windows" ]
class __metaclass__( type ):
#++---------------------------------------------------------------------------
# Details: Fn acts as an enumeration.
@ -64,11 +65,13 @@ def determine_os_type():
eOSType = EnumOsType.Unknown;
strOS = sys.platform
if strOS == "win32":
eOSType = EnumOsType.Windows;
elif (strOS == "linux") or (strOS == "linux2"):
eOSType = EnumOsType.Linux;
elif strOS == "darwin":
eOSType == EnumOsType.Darwin;
if strOS == "darwin":
eOSType = EnumOsType.Darwin
elif (strOS.startswith("freebsd")):
eOSType = EnumOsType.FreeBSD
elif (strOS.startswith("linux")):
eOSType = EnumOsType.Linux
elif strOS == "win32":
eOSType = EnumOsType.Windows
return eOSType;