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

Unified Diff: mojo/public/tools/gn/zip.py

Issue 1618243004: Use gn_helpers to deserialize GN lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
« no previous file with comments | « mojo/public/mojo_application.gni ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/gn/zip.py
diff --git a/mojo/public/tools/gn/zip.py b/mojo/public/tools/gn/zip.py
index 12c1879e4a5450ee02967ed04d9f066be0cc9fbc..0d4960f4a1a721959303a845eb33164bde14bd94 100755
--- a/mojo/public/tools/gn/zip.py
+++ b/mojo/public/tools/gn/zip.py
@@ -4,15 +4,22 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+# TODO(brettw) bug 582594: merge this with build/android/gn/zip.py and update
+# callers to use the existing template rather than invoking this directly.
+
"""Archives a set of files.
"""
-import ast
import optparse
import os
import sys
import zipfile
+sys.path.append(os.path.join(os.path.dirname(__file__),
+ os.pardir, os.pardir, os.pardir, os.pardir,
+ "build"))
+import gn_helpers
+
def DoZip(inputs, link_inputs, zip_inputs, output, base_dir):
files = []
with zipfile.ZipFile(output, 'w', zipfile.ZIP_DEFLATED) as outfile:
@@ -37,10 +44,12 @@ def DoZip(inputs, link_inputs, zip_inputs, output, base_dir):
def main():
parser = optparse.OptionParser()
- parser.add_option('--inputs', help='List of files to archive.')
+ parser.add_option('--inputs',
+ help='GN format list of files to archive.')
parser.add_option('--link-inputs',
- help='List of files to archive. Symbolic links are resolved.')
- parser.add_option('--zip-inputs', help='List of zip files to re-archive.')
+ help='GN-format list of files to archive. Symbolic links are resolved.')
+ parser.add_option('--zip-inputs',
+ help='GN-format list of zip files to re-archive.')
parser.add_option('--output', help='Path to output archive.')
parser.add_option('--base-dir',
help='If provided, the paths in the archive will be '
@@ -50,13 +59,19 @@ def main():
inputs = []
if (options.inputs):
- inputs = ast.literal_eval(options.inputs)
+ parser = gn_helpers.GNValueParser(options.inputs)
+ inputs = parser.ParseList()
+
link_inputs = []
if options.link_inputs:
- link_inputs = ast.literal_eval(options.link_inputs)
+ parser = gn_helpers.GNValueParser(options.link_inputs)
+ link_inputs = parser.ParseList()
+
zip_inputs = []
if options.zip_inputs:
- zip_inputs = ast.literal_eval(options.zip_inputs)
+ parser = gn_helpers.GNValueParser(options.zip_inputs)
+ zip_inputs = parser.ParseList()
+
output = options.output
base_dir = options.base_dir
« no previous file with comments | « mojo/public/mojo_application.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698