OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 """Unpacks pre-built sanitizer-instrumented third-party libraries.""" | |
7 | |
8 import os | |
9 import subprocess | |
10 import shutil | |
11 import sys | |
12 | |
13 import download_binaries | |
14 | |
15 | |
16 def get_archive_name(sanitizer_type): | |
17 return '%s-%s.tgz' % (sanitizer_type, download_binaries.get_ubuntu_release()) | |
earthdok
2015/05/28 18:27:46
Can we use consistent naming everywhere?
Here we
Sam McNally
2015/05/29 08:33:00
Done.
| |
18 | |
19 | |
20 def main(sanitizer_type, archive_dir, target_dir, stamp_dir=None): | |
21 shutil.rmtree(target_dir, ignore_errors=True) | |
22 | |
23 os.mkdir(target_dir) | |
24 subprocess.check_call([ | |
25 'tar', | |
26 '-zxf', | |
27 os.path.join(archive_dir, get_archive_name(sanitizer_type)), | |
28 '-C', | |
29 target_dir]) | |
30 stamp_file = os.path.join(stamp_dir or target_dir, '%s.txt' % sanitizer_type) | |
31 open(stamp_file, 'w').close() | |
32 | |
33 if stamp_dir: | |
34 with open(os.path.join(stamp_dir, '%s.d' % sanitizer_type), 'w') as f: | |
35 f.write('%s: %s' % ( | |
36 stamp_file, os.path.join(archive_dir, | |
37 get_archive_name(sanitizer_type)))) | |
38 return 0 | |
39 | |
40 | |
41 if __name__ == '__main__': | |
42 sys.exit(main(*sys.argv[1:])) | |
OLD | NEW |