| 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 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 def ExceptionAppend(e, msg): | 37 def ExceptionAppend(e, msg): |
| 38 """Append a message to the given exception's message.""" | 38 """Append a message to the given exception's message.""" |
| 39 if not e.args: | 39 if not e.args: |
| 40 e.args = (msg,) | 40 e.args = (msg,) |
| 41 elif len(e.args) == 1: | 41 elif len(e.args) == 1: |
| 42 e.args = (str(e.args[0]) + ' ' + msg,) | 42 e.args = (str(e.args[0]) + ' ' + msg,) |
| 43 else: | 43 else: |
| 44 e.args = (str(e.args[0]) + ' ' + msg,) + e.args[1:] | 44 e.args = (str(e.args[0]) + ' ' + msg,) + e.args[1:] |
| 45 | 45 |
| 46 | 46 |
| 47 def FindQualifiedTargets(target, qualified_list): | |
| 48 """ | |
| 49 Given a list of qualified targets, return the qualified targets for the | |
| 50 specified |target|. | |
| 51 """ | |
| 52 return [t for t in qualified_list if ParseQualifiedTarget(t)[1] == target] | |
| 53 | |
| 54 | |
| 55 def ParseQualifiedTarget(target): | 47 def ParseQualifiedTarget(target): |
| 56 # Splits a qualified target into a build file, target name and toolset. | 48 # Splits a qualified target into a build file, target name and toolset. |
| 57 | 49 |
| 58 # NOTE: rsplit is used to disambiguate the Windows drive letter separator. | 50 # NOTE: rsplit is used to disambiguate the Windows drive letter separator. |
| 59 target_split = target.rsplit(':', 1) | 51 target_split = target.rsplit(':', 1) |
| 60 if len(target_split) == 2: | 52 if len(target_split) == 2: |
| 61 [build_file, target] = target_split | 53 [build_file, target] = target_split |
| 62 else: | 54 else: |
| 63 build_file = None | 55 build_file = None |
| 64 | 56 |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 return | 496 return |
| 505 visited.add(node) | 497 visited.add(node) |
| 506 visiting.add(node) | 498 visiting.add(node) |
| 507 for neighbor in get_edges(node): | 499 for neighbor in get_edges(node): |
| 508 Visit(neighbor) | 500 Visit(neighbor) |
| 509 visiting.remove(node) | 501 visiting.remove(node) |
| 510 ordered_nodes.insert(0, node) | 502 ordered_nodes.insert(0, node) |
| 511 for node in sorted(graph): | 503 for node in sorted(graph): |
| 512 Visit(node) | 504 Visit(node) |
| 513 return ordered_nodes | 505 return ordered_nodes |
| OLD | NEW |