1.1 --- a/ambuild2/util.py Fri Sep 27 22:29:25 2013 -0700
1.2 +++ b/ambuild2/util.py Sun Sep 29 02:10:49 2013 -0700
1.3 @@ -1,6 +1,6 @@
1.4 # vim: set sts=2 ts=8 sw=2 tw=99 et:
1.5 -import os
1.6 -import sys
1.7 +import errno
1.8 +import os, sys
1.9 import subprocess
1.10 import multiprocessing
1.11 try:
1.12 @@ -17,18 +17,44 @@
1.13 return 'windows'
1.14 if IsMac():
1.15 return 'mac'
1.16 - if sys.platform[0:5] == 'linux':
1.17 + if IsLinux():
1.18 return 'linux'
1.19 + if IsFreeBSD():
1.20 + return 'freebsd'
1.21 + if IsOpenBSD():
1.22 + return 'openbsd'
1.23 + if IsNetBSD():
1.24 + return 'netbsd'
1.25 + if IsSolaris():
1.26 + return 'solaris'
1.27 return 'unknown'
1.28
1.29 +def IsLinux():
1.30 + return sys.platform[0:5] == 'linux'
1.31 +
1.32 +def IsFreeBSD():
1.33 + return sys.platform[0:7] == 'freebsd'
1.34 +
1.35 +def IsNetBSD():
1.36 + return sys.platform[0:6] == 'netbsd'
1.37 +
1.38 +def IsOpenBSD():
1.39 + return sys.platform[0:7] == 'openbsd'
1.40 +
1.41 def IsWindows():
1.42 return sys.platform == 'win32' or sys.platform == 'cygwin'
1.43
1.44 def IsMac():
1.45 - return sys.platform == 'darwin'
1.46 + return sys.platform == 'darwin' or sys.platform[0:6] == 'Darwin'
1.47 +
1.48 +def IsSolaris():
1.49 + return sys.platform[0:5] == 'sunos'
1.50
1.51 def IsUnixy():
1.52 - return sys.platform[0:5] == 'linux' or IsMac()
1.53 + return not IsWindows()
1.54 +
1.55 +def IsBSD():
1.56 + return IsMac() or IsFreeBSD() or IsOpenBSD() or IsNetBSD()
1.57
1.58 def ExecutableSuffix():
1.59 if IsWindows():
1.60 @@ -139,3 +165,4 @@
1.61 if type(blob) != bytes:
1.62 blob = bytes(blob)
1.63 return pickle.loads(blob)
1.64 +