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

Side by Side Diff: mojo/public/tools/gn/unzip.py

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « mojo/public/tools/gn/last_commit_timestamp.py ('k') | mojo/public/tools/gn/zip.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright 2015 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 """Extracts a set of zip archives. """
8
9 import ast
10 import optparse
11 import os
12 import sys
13 import zipfile
14
15 def DoUnzip(inputs, output):
16 if not os.path.exists(output):
17 os.makedirs(output)
18 for i in inputs:
19 with zipfile.ZipFile(i) as zf:
20 zf.extractall(output)
21
22
23 def main():
24 parser = optparse.OptionParser()
25
26 parser.add_option('--inputs', help='List of archives to extract.')
27 parser.add_option('--output', help='Path to unzip the archives to.')
28 parser.add_option('--timestamp', help='Path to a timestamp file.')
29
30 options, _ = parser.parse_args()
31
32 inputs = []
33 if (options.inputs):
34 inputs = ast.literal_eval(options.inputs)
35
36 DoUnzip(inputs, options.output)
37
38 if options.timestamp:
39 if os.path.exists(options.timestamp):
40 os.utime(options.timestamp, None)
41 else:
42 with open(options.timestamp, 'a'):
43 pass
44
45 if __name__ == '__main__':
46 sys.exit(main())
OLDNEW
« no previous file with comments | « mojo/public/tools/gn/last_commit_timestamp.py ('k') | mojo/public/tools/gn/zip.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698