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

Unified Diff: native_client_sdk/src/tools/getos.py

Issue 86053005: [NaCl SDK] Fix "make debug" and "make run" on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: feedback Created 7 years 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
« no previous file with comments | « native_client_sdk/src/tools/common.mk ('k') | native_client_sdk/src/tools/run.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/tools/getos.py
diff --git a/native_client_sdk/src/tools/getos.py b/native_client_sdk/src/tools/getos.py
index 70971a67a888392136e8c3ebdab8a1f450570783..7a72c80e30381a4d1d142ee2c50d1b87f66dd2d5 100755
--- a/native_client_sdk/src/tools/getos.py
+++ b/native_client_sdk/src/tools/getos.py
@@ -20,7 +20,11 @@ import oshelpers
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
-CHROME_EXE_BASENAME = 'google-chrome'
+CHROME_DEFAULT_PATH = {
+ 'win': r'c:\Program Files (x86)\Google\Chrome\Application\chrome.exe',
+ 'mac': '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
+ 'linux': '/usr/bin/google-chrome',
+}
if sys.version_info < (2, 6, 0):
@@ -102,18 +106,27 @@ def GetSystemArch(platform):
return arch
-def GetChromePath():
+def GetChromePath(platform):
+ # If CHROME_PATH is defined and exists, use that.
chrome_path = os.environ.get('CHROME_PATH')
if chrome_path:
if not os.path.exists(chrome_path):
raise Error('Invalid CHROME_PATH: %s' % chrome_path)
- else:
- chrome_path = oshelpers.FindExeInPath(CHROME_EXE_BASENAME)
- if not chrome_path:
- raise Error('CHROME_PATH is undefined, and %s not found in PATH.' %
- CHROME_EXE_BASENAME)
+ return os.path.realpath(chrome_path)
+
+ # Otherwise look in the PATH environment variable.
+ chrome_path = CHROME_DEFAULT_PATH[platform]
+ basename = os.path.basename(chrome_path)
+ chrome_path = oshelpers.FindExeInPath(basename)
+ if chrome_path:
+ return os.path.realpath(chrome_path)
+
+ # Finally, try the default paths to Chrome.
+ if os.path.exists(chrome_path):
+ return os.path.realpath(chrome_path)
- return os.path.realpath(chrome_path)
+ raise Error('CHROME_PATH is undefined, and %s not found in PATH, nor %s.' % (
+ basename, chrome_path))
def GetNaClArch(platform):
@@ -126,7 +139,7 @@ def GetNaClArch(platform):
# On linux the nacl arch matches to chrome arch, so we inspect the chrome
# binary using objdump
- chrome_path = GetChromePath()
+ chrome_path = GetChromePath(platform)
# If CHROME_PATH is set to point to google-chrome or google-chrome
# was found in the PATH and we are running on UNIX then google-chrome
@@ -239,7 +252,7 @@ def main(args):
elif options.nacl_arch:
out = GetNaClArch(platform)
elif options.chrome:
- out = GetChromePath()
+ out = GetChromePath(platform)
elif options.helper:
out = GetHelperPath(platform)
elif options.irtbin:
« no previous file with comments | « native_client_sdk/src/tools/common.mk ('k') | native_client_sdk/src/tools/run.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698