OLD | NEW |
---|---|
(Empty) | |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import os | |
6 import subprocess | |
7 import sys | |
8 | |
9 # This script creates a BZ2-compressed TAR file for archiving Chrome symbols. | |
10 | |
11 def Main(args): | |
12 if len(args) < 3: | |
13 print >> sys.stderr, "Usage: python archive_symbols.py file.tar.bz2 file..." | |
14 return 1 | |
15 | |
16 _RemoveIfExists(args[1]) | |
17 | |
18 try: | |
19 return subprocess.check_call(['tar', '-cjf'] + args[1:]) | |
20 except: | |
21 _RemoveIfExists(args[1]) | |
22 raise | |
23 | |
24 | |
25 def _RemoveIfExists(path): | |
26 if os.path.exists(path): | |
Mark Mentovai
2016/06/09 18:48:04
try-catch swallowing OSError ENOENT might be more
Robert Sesek
2016/06/09 20:53:46
Ack, but will keep since this pattern is in a few
| |
27 os.unlink(path) | |
28 | |
29 | |
30 if __name__ == '__main__': | |
31 sys.exit(Main(sys.argv)) | |
Mark Mentovai
2016/06/09 18:48:04
I like to call main with sys.argv[1:] (especially
Robert Sesek
2016/06/09 20:53:46
Done.
| |
OLD | NEW |