Chromium Code Reviews| Index: grit/format/resource_map.py |
| diff --git a/grit/format/resource_map.py b/grit/format/resource_map.py |
| index 37ac54ad3986d73363c3bc306f8828be02128617..950400496fd478ab30a7724921622b1ccca0e09c 100644 |
| --- a/grit/format/resource_map.py |
| +++ b/grit/format/resource_map.py |
| @@ -5,7 +5,8 @@ |
| '''This file contains item formatters for resource_map_header and |
| resource_map_source files. A resource map is a mapping between resource names |
| -(string) and the internal resource ID.''' |
| +(string) and the internal resource ID. It is output with an alphabetical order |
| +of resource names.''' |
| import os |
| from functools import partial |
| @@ -108,11 +109,15 @@ def _FormatSource(get_key, root, lang, output_dir): |
| yield _FormatSourceHeader(root) |
| tids = rc_header.GetIds(root) |
| seen = set() |
| + items = [] |
| active_descendants = [item for item in root.ActiveDescendants()] |
| output_all_resource_defines = root.ShouldOutputAllResourceDefines() |
| for item in root: |
| if not item.IsResourceMapSource(): |
| continue |
| + items.append(item) |
|
flackr
2015/08/27 22:03:15
nit: Prefer list comprehension over looping to bui
|
| + items = sorted(items, key=get_key) |
| + for item in items: |
| key = get_key(item) |
| tid = item.attrs['name'] |
| if tid not in tids or key in seen: |
|
flackr
2015/08/27 22:03:15
now that we're sorted by key we should just compar
|