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

Unified Diff: build/android/gyp/util/build_utils.py

Issue 1647353002: Use gn_helpers to [se]serialize GN lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@python_impl
Patch Set: Created 4 years, 11 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
Index: build/android/gyp/util/build_utils.py
diff --git a/build/android/gyp/util/build_utils.py b/build/android/gyp/util/build_utils.py
index c601e06d7157fd97855749a8ecd781c22aac590f..beb7bcfbf1e9c8cbd0a5ef85dd5e6083b588b04f 100644
--- a/build/android/gyp/util/build_utils.py
+++ b/build/android/gyp/util/build_utils.py
@@ -22,6 +22,10 @@ import md5_check # pylint: disable=relative-import
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
from pylib.constants import host_paths
+sys.path.append(os.path.join(os.path.dirname(__file__),
+ os.pardir, os.pardir, os.pardir))
+import gn_helpers
+
COLORAMA_ROOT = os.path.join(host_paths.DIR_SOURCE_ROOT,
'third_party', 'colorama', 'src')
# aapt should ignore OWNERS files in addition the default ignore pattern.
@@ -77,18 +81,8 @@ def FindInDirectories(directories, filename_filter):
def ParseGnList(gn_string):
- # TODO(brettw) bug 573132: This doesn't handle GN escaping properly, so any
- # weird characters like $ or \ in the strings will be corrupted.
- #
- # The code should import build/gn_helpers.py and then do:
- # parser = gn_helpers.GNValueParser(gn_string)
- # return return parser.ParseList()
- # As of this writing, though, there is a CastShell build script that sends
- # JSON through this function, and using correct GN parsing corrupts that.
- #
- # We need to be consistent about passing either JSON or GN lists through
- # this function.
- return ast.literal_eval(gn_string)
+ parser = gn_helpers.GNValueParser(gn_string)
+ return parser.ParseList()
def ParseGypList(gyp_string):

Powered by Google App Engine
This is Rietveld 408576698