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

Unified Diff: components/variations/service/generate_ui_string_overrider.py

Issue 1411153006: Variations string overrides now handles more .grd files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: expanded the comment a bit more Created 5 years, 2 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
« chrome/browser/metrics/variations/BUILD.gn ('K') | « chrome/chrome_resources.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/variations/service/generate_ui_string_overrider.py
diff --git a/components/variations/service/generate_ui_string_overrider.py b/components/variations/service/generate_ui_string_overrider.py
index 288272cfb5657288af381e752efb2be324298a83..9be11de191cc6600a322e1b1922f76e3005bcc7b 100755
--- a/components/variations/service/generate_ui_string_overrider.py
+++ b/components/variations/service/generate_ui_string_overrider.py
@@ -71,6 +71,10 @@ def _GetResourceListFromString(resources_content):
resources = [Resource(_HashName(name), name, index) for name, index in
_GetNameIndexPairsIter(resources_content)]
+ # Deduplicate resources. Some name-index pairs appear in multiple header
+ # files. Unless deduplicated here, collisions will be raised in _CheckForHashCollisions
jwd 2015/10/26 15:11:15 Nit: line too long.
Moe 2015/10/26 16:23:52 Done.
+ resources = list(set(resources))
+
# The default |Resource| order makes |resources| sorted by the hash, then
# name, then index.
resources.sort()
@@ -160,7 +164,7 @@ def _GenerateSourceFileContent(resources_content, namespace, header_filename):
collisions = _CheckForHashCollisions(hashed_tuples)
if collisions:
error_message = "\n".join(
- ["hash: %i, name: %s" % (i[0], i[1]) for i in sorted(collisions)])
+ ["hash: %i, name: %s" % (i.hash, i.name) for i in sorted(collisions)])
error_message = ("\nThe following names had hash collisions "
"(sorted by the hash value):\n%s\n" %(error_message))
raise HashCollisionError(error_message)
« chrome/browser/metrics/variations/BUILD.gn ('K') | « chrome/chrome_resources.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698