OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Determine OS and various other system properties. | 6 """Determine OS and various other system properties. |
7 | 7 |
8 Determine the name of the platform used and other system properties such as | 8 Determine the name of the platform used and other system properties such as |
9 the location of Chrome. This is used, for example, to determine the correct | 9 the location of Chrome. This is used, for example, to determine the correct |
10 Toolchain to invoke. | 10 Toolchain to invoke. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 chrome_path = oshelpers.FindExeInPath(CHROME_EXE_BASENAME) | 111 chrome_path = oshelpers.FindExeInPath(CHROME_EXE_BASENAME) |
112 if not chrome_path: | 112 if not chrome_path: |
113 raise Error('CHROME_PATH is undefined, and %s not found in PATH.' % | 113 raise Error('CHROME_PATH is undefined, and %s not found in PATH.' % |
114 CHROME_EXE_BASENAME) | 114 CHROME_EXE_BASENAME) |
115 | 115 |
116 return os.path.realpath(chrome_path) | 116 return os.path.realpath(chrome_path) |
117 | 117 |
118 | 118 |
119 def GetNaClArch(platform): | 119 def GetNaClArch(platform): |
120 if platform == 'win': | 120 if platform == 'win': |
121 # On windows the nacl arch always maches to system arch | 121 # On windows the nacl arch always matches to system arch |
122 return GetSystemArch(platform) | 122 return GetSystemArch(platform) |
123 elif platform == 'mac': | 123 elif platform == 'mac': |
124 # On Mac the nacl arch is currently always 32-bit. | 124 # On Mac the nacl arch is currently always 32-bit. |
125 return 'x86_32' | 125 return 'x86_32' |
126 | 126 |
127 # On linux the nacl arch matches to chrome arch, so we inspect the chome | 127 # On linux the nacl arch matches to chrome arch, so we inspect the chrome |
128 # binary using objdump | 128 # binary using objdump |
129 chrome_path = GetChromePath() | 129 chrome_path = GetChromePath() |
130 | 130 |
131 # If CHROME_PATH is set to point to google-chrome or google-chrome | 131 # If CHROME_PATH is set to point to google-chrome or google-chrome |
132 # was found in the PATH and we are running on UNIX then google-chrome | 132 # was found in the PATH and we are running on UNIX then google-chrome |
133 # is a bash script that points to 'chrome' in the same folder. | 133 # is a bash script that points to 'chrome' in the same folder. |
134 if os.path.basename(chrome_path) == 'google-chrome': | 134 if os.path.basename(chrome_path) == 'google-chrome': |
135 chrome_path = os.path.join(os.path.dirname(chrome_path), 'chrome') | 135 chrome_path = os.path.join(os.path.dirname(chrome_path), 'chrome') |
136 | 136 |
137 try: | 137 try: |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 print out | 263 print out |
264 return 0 | 264 return 0 |
265 | 265 |
266 | 266 |
267 if __name__ == '__main__': | 267 if __name__ == '__main__': |
268 try: | 268 try: |
269 sys.exit(main(sys.argv[1:])) | 269 sys.exit(main(sys.argv[1:])) |
270 except Error as e: | 270 except Error as e: |
271 sys.stderr.write(str(e) + '\n') | 271 sys.stderr.write(str(e) + '\n') |
272 sys.exit(1) | 272 sys.exit(1) |
OLD | NEW |