Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # | |
| 3 # Copyright 2016 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 """Upacks the contents of an Android AAR.""" | |
| 8 | |
| 9 import os | |
| 10 import sys | |
| 11 import zipfile | |
| 12 | |
| 13 | |
| 14 def main(): | |
| 15 if len(sys.argv) != 3: | |
| 16 print 'Usage: %s <aar_file> <output_dir>' % sys.argv[0] | |
| 17 sys.exit(1) | |
| 18 | |
| 19 aar_file = sys.argv[1] # e.g. library.aar | |
| 20 output_dir = sys.argv[2] # e.g. path/to/output | |
| 21 | |
| 22 #library_filename = os.path.basename(output_file) | |
| 23 #library_in_jar = os.path.join(library_filename) | |
| 24 | |
| 25 with zipfile.ZipFile(aar_file, 'r') as archive: | |
| 26 archive.extractall(output_dir) | |
|
agrieve
2016/06/16 02:00:04
Probably a good idea to assert that the .aar has n
agrieve
2016/06/16 02:00:04
nit: you don't need to extract res/, so probably s
agrieve
2016/06/16 02:00:04
Probably a good idea to shutil.rmtree() first so t
agrieve
2016/06/16 02:00:04
do you need an os.makedirs() first?
agrieve
2016/06/16 02:00:04
For extra extra bonus points, it might be useful t
| |
| 27 | |
| 28 | |
| 29 if __name__ == '__main__': | |
| 30 sys.exit(main()) | |
| OLD | NEW |