Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Unified Diff: grit/format/resource_map.py

Issue 1312723006: GritResourceMap: output sorted by keys Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: Fixed unittests, added comment Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | grit/format/resource_map_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | grit/format/resource_map_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698