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

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

Issue 1969243002: Fix regex to parse Variations UI override strings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | 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 6e43559d60f99cf65f57439ef6ab8ce20c8e5431..d15228cceda8f7683f3ce8f98191eff41343f8f2 100755
--- a/components/variations/service/generate_ui_string_overrider.py
+++ b/components/variations/service/generate_ui_string_overrider.py
@@ -12,7 +12,19 @@ import re
import sys
SCRIPT_NAME = "generate_ui_string_overrider.py"
+
Raj 2016/05/12 01:40:27 The pragma format is defined in https://code.googl
+
+# Regular expressions for parsing the #define macro format. Separate regular
+# expressions are used for parsing lines with pragma (for builds with
+# enable_resource_whitelist_generation flag) in windows and non-windows, and for
+# lines without pragma,
rkaplow 2016/05/12 01:52:53 could you give samples for the cases here
Raj 2016/05/12 17:03:40 Done.
RESOURCE_EXTRACT_REGEX = re.compile('^#define (\S*) (\d*)$', re.MULTILINE)
+RESOURCE_EXTRACT_REGEX_PRAGMA = re.compile(
+ '^#define (\S*) _Pragma\("whitelisted_resource_\d*"\) (\d*)$',
Alexei Svitkine (slow) 2016/05/12 14:40:41 Looks like these are defined here: https://code.g
Raj 2016/05/12 17:03:40 Sure. I will add the comment in a separate CL. I d
+ re.MULTILINE)
+RESOURCE_EXTRACT_REGEX_PRAGMA_WINDOWS = re.compile(
Raj 2016/05/12 01:40:27 Not tested with Windows yet. Will test asap.
Raj 2016/05/12 01:47:29 I tested in linux for android build, that builds w
+ '^#define (\S*) __pragma\(message\("whitelisted_resource_\d*"\)\) (\d*)$',
rkaplow 2016/05/12 01:52:53 just to verify this isn't a typo - this is lowerca
Raj 2016/05/12 17:03:40 Yes. The pragma format is defined in: https://code
+ re.MULTILINE)
class Error(Exception):
"""Base error class for all exceptions in generated_resources_map."""
@@ -53,6 +65,10 @@ def _GetNameIndexPairsIter(string_to_scan):
"""
for match in RESOURCE_EXTRACT_REGEX.finditer(string_to_scan):
yield match.group(1, 2)
+ for match in RESOURCE_EXTRACT_REGEX_PRAGMA.finditer(string_to_scan):
+ yield match.group(1, 2)
+ for match in RESOURCE_EXTRACT_REGEX_PRAGMA_WINDOWS.finditer(string_to_scan):
+ yield match.group(1, 2)
def _GetResourceListFromString(resources_content):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698