Пример #1
0
def modify_channel(channel):
    path = '%s/AndroidManifest.xml' % (get_source_file_path(channel))
    tree = xml_helper.read_xml(path)
    nodes = xml_helper.find_nodes(tree, 'application/meta-data')
    result_nodes = xml_helper.get_node_by_keyvalue(nodes, {get_attrib_in_android_xml('name'): "CHANNEL"})
    xml_helper.change_node_properties(result_nodes, {get_attrib_in_android_xml('value'): channel})
    xml_helper.write_xml(tree, path)
Пример #2
0
 def modify_xml_file(self, file_path, tag, node_name, value):
     tree = xml_helper.read_xml(file_path)
     nodes = xml_helper.find_nodes(tree, tag)
     result_nodes = xml_helper.get_node_by_keyvalue(nodes,
                                                    {"name": node_name})
     xml_helper.change_node_text(result_nodes, value)
     xml_helper.write_xml(tree, file_path)
     pass
Пример #3
0
def modify_provider(channel, package):
    path = '%s/AndroidManifest.xml' % (get_source_file_path(channel))
    tree = xml_helper.read_xml(path)
    nodes = xml_helper.find_nodes(tree, 'application/provider')
    xml_helper.change_node_properties(
        nodes,
        {get_attrib_in_android_xml('authorities'): '%s.provider' % (package)})
    xml_helper.write_xml(tree, path)
Пример #4
0
def modify_apk_package(channel, package):
    path = '%s/AndroidManifest.xml' % (get_source_file_path(channel))
    tree = xml_helper.read_xml(path)
    root = tree.getroot()
    root.attrib['package'] = package
    xml_helper.write_xml(tree, path)