Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from __future__ import with_statement | 5 from __future__ import with_statement |
| 6 | 6 |
| 7 import errno | 7 import errno |
| 8 import filecmp | 8 import filecmp |
| 9 import os.path | 9 import os.path |
| 10 import platform | |
| 10 import re | 11 import re |
| 11 import tempfile | 12 import tempfile |
| 12 import sys | 13 import sys |
| 13 | 14 |
| 14 | 15 |
| 15 # A minimal memoizing decorator. It'll blow up if the args aren't immutable, | 16 # A minimal memoizing decorator. It'll blow up if the args aren't immutable, |
| 16 # among other "problems". | 17 # among other "problems". |
| 17 class memoize(object): | 18 class memoize(object): |
| 18 def __init__(self, func): | 19 def __init__(self, func): |
| 19 self.func = func | 20 self.func = func |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 if sys.platform.startswith('freebsd'): | 394 if sys.platform.startswith('freebsd'): |
| 394 return 'freebsd' | 395 return 'freebsd' |
| 395 if sys.platform.startswith('openbsd'): | 396 if sys.platform.startswith('openbsd'): |
| 396 return 'openbsd' | 397 return 'openbsd' |
| 397 if sys.platform.startswith('aix'): | 398 if sys.platform.startswith('aix'): |
| 398 return 'aix' | 399 return 'aix' |
| 399 | 400 |
| 400 return 'linux' | 401 return 'linux' |
| 401 | 402 |
| 402 | 403 |
| 404 def DetectHostArchitecture(): | |
| 405 """Returns the system's architecture.""" | |
|
Torne
2013/03/11 16:16:50
This matches all the machine types that are curren
| |
| 406 architectures = { | |
| 407 'i86pc': 'ia32', | |
| 408 'x86_64': 'x64', | |
| 409 'amd64': 'x64', | |
| 410 } | |
| 411 | |
| 412 machine = platform.machine() | |
| 413 if machine in architectures: | |
| 414 return architectures[machine] | |
| 415 if re.match('i.86$', machine): | |
| 416 return 'ia32' | |
| 417 if machine.startswith('arm'): | |
| 418 return 'arm' | |
| 419 if machine.startswith('mips'): | |
| 420 return 'mipsel' | |
| 421 | |
| 422 return 'unknown' | |
| 423 | |
| 424 | |
| 403 def CopyTool(flavor, out_path): | 425 def CopyTool(flavor, out_path): |
| 404 """Finds (mac|sun|win)_tool.gyp in the gyp directory and copies it | 426 """Finds (mac|sun|win)_tool.gyp in the gyp directory and copies it |
| 405 to |out_path|.""" | 427 to |out_path|.""" |
| 406 prefix = { 'solaris': 'sun', 'mac': 'mac', 'win': 'win' }.get(flavor, None) | 428 prefix = { 'solaris': 'sun', 'mac': 'mac', 'win': 'win' }.get(flavor, None) |
| 407 if not prefix: | 429 if not prefix: |
| 408 return | 430 return |
| 409 | 431 |
| 410 # Slurp input file. | 432 # Slurp input file. |
| 411 source_path = os.path.join( | 433 source_path = os.path.join( |
| 412 os.path.dirname(os.path.abspath(__file__)), '%s_tool.py' % prefix) | 434 os.path.dirname(os.path.abspath(__file__)), '%s_tool.py' % prefix) |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 482 return | 504 return |
| 483 visited.add(node) | 505 visited.add(node) |
| 484 visiting.add(node) | 506 visiting.add(node) |
| 485 for neighbor in get_edges(node): | 507 for neighbor in get_edges(node): |
| 486 Visit(neighbor) | 508 Visit(neighbor) |
| 487 visiting.remove(node) | 509 visiting.remove(node) |
| 488 ordered_nodes.insert(0, node) | 510 ordered_nodes.insert(0, node) |
| 489 for node in sorted(graph): | 511 for node in sorted(graph): |
| 490 Visit(node) | 512 Visit(node) |
| 491 return ordered_nodes | 513 return ordered_nodes |
| OLD | NEW |