Index: pylib/gyp/common.py |
diff --git a/pylib/gyp/common.py b/pylib/gyp/common.py |
index e50f51c3079768f65d18f164af4fc7fee5a8f262..d1bd3b878e670a84a025797901c12cba2d0fac05 100644 |
--- a/pylib/gyp/common.py |
+++ b/pylib/gyp/common.py |
@@ -7,6 +7,7 @@ from __future__ import with_statement |
import errno |
import filecmp |
import os.path |
+import platform |
import re |
import tempfile |
import sys |
@@ -400,6 +401,27 @@ def GetFlavor(params): |
return 'linux' |
+def DetectHostArchitecture(): |
+ """Returns the system's architecture.""" |
Torne
2013/03/11 16:16:50
This matches all the machine types that are curren
|
+ architectures = { |
+ 'i86pc': 'ia32', |
+ 'x86_64': 'x64', |
+ 'amd64': 'x64', |
+ } |
+ |
+ machine = platform.machine() |
+ if machine in architectures: |
+ return architectures[machine] |
+ if re.match('i.86$', machine): |
+ return 'ia32' |
+ if machine.startswith('arm'): |
+ return 'arm' |
+ if machine.startswith('mips'): |
+ return 'mipsel' |
+ |
+ return 'unknown' |
+ |
+ |
def CopyTool(flavor, out_path): |
"""Finds (mac|sun|win)_tool.gyp in the gyp directory and copies it |
to |out_path|.""" |