OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 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 import collections | 6 import collections |
7 import fnmatch | 7 import fnmatch |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import sys | 10 import sys |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 filepath = os.path.join(root, filename) | 177 filepath = os.path.join(root, filename) |
178 try: | 178 try: |
179 desc = LoadProject(filepath) | 179 desc = LoadProject(filepath) |
180 except ValidationError as e: | 180 except ValidationError as e: |
181 raise ValidationError("Failed to validate: %s: %s" % (filepath, e)) | 181 raise ValidationError("Failed to validate: %s: %s" % (filepath, e)) |
182 if desc: | 182 if desc: |
183 key = desc['DEST'] | 183 key = desc['DEST'] |
184 out[key].append(desc) | 184 out[key].append(desc) |
185 return out | 185 return out |
186 | 186 |
187 def OrderTree(project_tree): | |
binji
2014/04/28 21:01:22
?
noelallen1
2014/04/28 23:00:33
Done.
| |
188 return project_tree | |
187 | 189 |
188 def LoadProjectTree(srcpath, include, exclude=None): | 190 def LoadProjectTree(srcpath, include, exclude=None): |
189 out = LoadProjectTreeUnfiltered(srcpath) | 191 out = LoadProjectTreeUnfiltered(srcpath) |
190 return FilterTree(out, MakeDefaultFilterFn(include, exclude)) | 192 out = FilterTree(out, MakeDefaultFilterFn(include, exclude)) |
193 out = OrderTree(out) | |
194 return out | |
191 | 195 |
192 | 196 |
193 def GenerateProjects(tree): | 197 def GenerateProjects(tree): |
194 for key in tree: | 198 for key in tree: |
195 for val in tree[key]: | 199 for val in tree[key]: |
196 yield key, val | 200 yield key, val |
197 | 201 |
198 | 202 |
199 def FilterTree(tree, filter_fn): | 203 def FilterTree(tree, filter_fn): |
200 out = collections.defaultdict(list) | 204 out = collections.defaultdict(list) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 except ValidationError as e: | 275 except ValidationError as e: |
272 sys.stderr.write(str(e) + '\n') | 276 sys.stderr.write(str(e) + '\n') |
273 return 1 | 277 return 1 |
274 | 278 |
275 PrintProjectTree(tree) | 279 PrintProjectTree(tree) |
276 return 0 | 280 return 0 |
277 | 281 |
278 | 282 |
279 if __name__ == '__main__': | 283 if __name__ == '__main__': |
280 sys.exit(main(sys.argv)) | 284 sys.exit(main(sys.argv)) |
OLD | NEW |