Index: tools/utils.py |
=================================================================== |
--- tools/utils.py (revision 671) |
+++ tools/utils.py (working copy) |
@@ -43,6 +43,20 @@ |
return list |
+def GuessOS(): |
+ id = platform.system() |
+ if id == 'Linux': |
+ return 'linux' |
+ elif id == 'Darwin': |
+ return 'macos' |
+ elif id == 'Windows' or id == 'Microsoft': |
+ # On Windows Vista platform.system() can return 'Microsoft' with some |
+ # versions of Python, see http://bugs.python.org/issue1082 |
+ return 'win32' |
+ else: |
+ return None |
+ |
+ |
def GuessArchitecture(): |
id = platform.machine() |
if id.startswith('arm'): |
@@ -51,3 +65,14 @@ |
return 'ia32' |
else: |
return None |
+ |
+ |
+def GuessWordsize(): |
+ if '64' in platform.machine(): |
+ return '64' |
+ else: |
+ return '32' |
+ |
+ |
+def IsWindows(): |
+ return GuessOS() == 'win32' |