Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Unified Diff: pylib/gyp/common.py

Issue 12638013: Add options for host/target OS/arch. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« pylib/gyp/__init__.py ('K') | « pylib/gyp/__init__.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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|."""
« pylib/gyp/__init__.py ('K') | « pylib/gyp/__init__.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698