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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 toolset = parsed_toolset | 88 toolset = parsed_toolset |
89 | 89 |
90 return [build_file, target, toolset] | 90 return [build_file, target, toolset] |
91 | 91 |
92 | 92 |
93 def BuildFile(fully_qualified_target): | 93 def BuildFile(fully_qualified_target): |
94 # Extracts the build file from the fully qualified target. | 94 # Extracts the build file from the fully qualified target. |
95 return ParseQualifiedTarget(fully_qualified_target)[0] | 95 return ParseQualifiedTarget(fully_qualified_target)[0] |
96 | 96 |
97 | 97 |
| 98 def GetEnvironFallback(var_list, default): |
| 99 """Look up a key in the environment, with fallback to secondary keys |
| 100 and finally falling back to a default value.""" |
| 101 for var in var_list: |
| 102 if var in os.environ: |
| 103 return os.environ[var] |
| 104 return default |
| 105 |
| 106 |
98 def QualifiedTarget(build_file, target, toolset): | 107 def QualifiedTarget(build_file, target, toolset): |
99 # "Qualified" means the file that a target was defined in and the target | 108 # "Qualified" means the file that a target was defined in and the target |
100 # name, separated by a colon, suffixed by a # and the toolset name: | 109 # name, separated by a colon, suffixed by a # and the toolset name: |
101 # /path/to/file.gyp:target_name#toolset | 110 # /path/to/file.gyp:target_name#toolset |
102 fully_qualified = build_file + ':' + target | 111 fully_qualified = build_file + ':' + target |
103 if toolset: | 112 if toolset: |
104 fully_qualified = fully_qualified + '#' + toolset | 113 fully_qualified = fully_qualified + '#' + toolset |
105 return fully_qualified | 114 return fully_qualified |
106 | 115 |
107 | 116 |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 return | 452 return |
444 visited.add(node) | 453 visited.add(node) |
445 visiting.add(node) | 454 visiting.add(node) |
446 for neighbor in get_edges(node): | 455 for neighbor in get_edges(node): |
447 Visit(neighbor) | 456 Visit(neighbor) |
448 visiting.remove(node) | 457 visiting.remove(node) |
449 ordered_nodes.insert(0, node) | 458 ordered_nodes.insert(0, node) |
450 for node in sorted(graph): | 459 for node in sorted(graph): |
451 Visit(node) | 460 Visit(node) |
452 return ordered_nodes | 461 return ordered_nodes |
OLD | NEW |