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

Unified Diff: third_party/mojo/src/mojo/public/tools/gn/unzip.py

Issue 1127293003: Update mojo sdk to rev f84766d3b6420b7cf6a113d9d65d73cb5fe18d90 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: formatting Created 5 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 | « third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/module.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/mojo/src/mojo/public/tools/gn/unzip.py
diff --git a/third_party/mojo/src/mojo/public/tools/gn/unzip.py b/third_party/mojo/src/mojo/public/tools/gn/unzip.py
new file mode 100755
index 0000000000000000000000000000000000000000..988fc0805de6956344ac04ae33514c824bb59192
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/tools/gn/unzip.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+#
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Extracts a set of zip archives. """
+
+import ast
+import optparse
+import os
+import sys
+import zipfile
+
+def DoUnzip(inputs, output):
+ if not os.path.exists(output):
+ os.makedirs(output)
+ for i in inputs:
+ with zipfile.ZipFile(i) as zf:
+ zf.extractall(output)
+
+
+def main():
+ parser = optparse.OptionParser()
+
+ parser.add_option('--inputs', help='List of archives to extract.')
+ parser.add_option('--output', help='Path to unzip the archives to.')
+ parser.add_option('--timestamp', help='Path to a timestamp file.')
+
+ options, _ = parser.parse_args()
+
+ inputs = []
+ if (options.inputs):
+ inputs = ast.literal_eval(options.inputs)
+
+ DoUnzip(inputs, options.output)
+
+ if options.timestamp:
+ if os.path.exists(options.timestamp):
+ os.utime(options.timestamp, None)
+ else:
+ with open(options.timestamp, 'a'):
+ pass
+
+if __name__ == '__main__':
+ sys.exit(main())
« no previous file with comments | « third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/module.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698