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 re | 10 import re |
11 import tempfile | 11 import tempfile |
12 import sys | 12 import sys |
13 import pprint | |
Torne
2012/08/22 11:23:21
Left over from debugging?
| |
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 |
20 self.cache = {} | 21 self.cache = {} |
21 def __call__(self, *args): | 22 def __call__(self, *args): |
22 try: | 23 try: |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
363 'darwin': 'mac', | 364 'darwin': 'mac', |
364 'sunos5': 'solaris', | 365 'sunos5': 'solaris', |
365 'freebsd7': 'freebsd', | 366 'freebsd7': 'freebsd', |
366 'freebsd8': 'freebsd', | 367 'freebsd8': 'freebsd', |
367 'freebsd9': 'freebsd', | 368 'freebsd9': 'freebsd', |
368 } | 369 } |
369 flavor = flavors.get(sys.platform, 'linux') | 370 flavor = flavors.get(sys.platform, 'linux') |
370 return params.get('flavor', flavor) | 371 return params.get('flavor', flavor) |
371 | 372 |
372 | 373 |
374 def GetHostFlavor(params): | |
375 """Returns |params.options.host_flavor| if it's set, the system's default | |
376 flavor else.""" | |
377 options = params.get('options') | |
378 if options.host_flavor: | |
379 host_flavor = options.host_flavor | |
380 else: | |
381 host_flavor = GetFlavor({}) | |
382 return host_flavor; | |
383 | |
384 | |
373 def CopyTool(flavor, out_path): | 385 def CopyTool(flavor, out_path): |
374 """Finds (mac|sun|win)_tool.gyp in the gyp directory and copies it | 386 """Finds (mac|sun|win)_tool.gyp in the gyp directory and copies it |
375 to |out_path|.""" | 387 to |out_path|.""" |
376 prefix = { 'solaris': 'sun', 'mac': 'mac', 'win': 'win' }.get(flavor, None) | 388 prefix = { 'solaris': 'sun', 'mac': 'mac', 'win': 'win' }.get(flavor, None) |
377 if not prefix: | 389 if not prefix: |
378 return | 390 return |
379 | 391 |
380 # Slurp input file. | 392 # Slurp input file. |
381 source_path = os.path.join( | 393 source_path = os.path.join( |
382 os.path.dirname(os.path.abspath(__file__)), '%s_tool.py' % prefix) | 394 os.path.dirname(os.path.abspath(__file__)), '%s_tool.py' % prefix) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 return | 464 return |
453 visited.add(node) | 465 visited.add(node) |
454 visiting.add(node) | 466 visiting.add(node) |
455 for neighbor in get_edges(node): | 467 for neighbor in get_edges(node): |
456 Visit(neighbor) | 468 Visit(neighbor) |
457 visiting.remove(node) | 469 visiting.remove(node) |
458 ordered_nodes.insert(0, node) | 470 ordered_nodes.insert(0, node) |
459 for node in sorted(graph): | 471 for node in sorted(graph): |
460 Visit(node) | 472 Visit(node) |
461 return ordered_nodes | 473 return ordered_nodes |
OLD | NEW |