OLD | NEW |
(Empty) | |
| 1 # Copyright 2014 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 argparse |
| 6 import os |
| 7 import re |
| 8 import shutil |
| 9 import sys |
| 10 import xml.etree.ElementTree |
| 11 |
| 12 from xml.dom import minidom |
| 13 |
| 14 from util import build_utils |
| 15 |
| 16 DECONSTRUCTED_APPLICATION = 'org.chromium.deconstructed.DeconstructedApplication
' |
| 17 |
| 18 def main(args): |
| 19 parser = argparse.ArgumentParser() |
| 20 parser.add_argument('--in-manifest') |
| 21 parser.add_argument('--out-manifest') |
| 22 parser.add_argument('--out-data') |
| 23 options = parser.parse_args(args) |
| 24 |
| 25 manifest_xml = xml.etree.ElementTree.parse(options.in_manifest) |
| 26 manifest = manifest_xml.getroot() |
| 27 app_list = manifest.findall('application') |
| 28 if len(app_list) != 1: |
| 29 return 1 |
| 30 app_node = app_list[0] |
| 31 |
| 32 name_key = '{http://schemas.android.com/apk/res/android}name' |
| 33 old_application = app_node.get(name_key) |
| 34 app_node.set(name_key, DECONSTRUCTED_APPLICATION) |
| 35 package = manifest.get('package') |
| 36 |
| 37 manifest_xml.write(options.out_manifest) |
| 38 with open(options.out_data, 'w') as outfile: |
| 39 outfile.write('\n'.join([package, old_application])) |
| 40 |
| 41 |
| 42 if __name__ == "__main__": |
| 43 main(sys.argv[1:]) |
| 44 |
OLD | NEW |