|
@@ -428,6 +428,41 @@ def readAllRes(resFile, resList):
|
|
|
resList += root.getchildren()
|
|
|
return resList
|
|
|
|
|
|
+def removeIdFromPublic(pubFile, removeList):
|
|
|
+ '''
|
|
|
+ 删除重复的资源
|
|
|
+ '''
|
|
|
+ tree = ET.parse(pubFile)
|
|
|
+ root = tree.getroot()
|
|
|
+
|
|
|
+ same = False
|
|
|
+ for node in root.getchildren():
|
|
|
+ if containPublic(node, removeList):
|
|
|
+ print('delete public node : type is %s, name is %s' % (node.attrib['type'], node.attrib['name']))
|
|
|
+ root.remove(node)
|
|
|
+ same = True
|
|
|
+ if same:
|
|
|
+ tree.write(pubFile, encoding)
|
|
|
+
|
|
|
+def removeSameRes2(resFile, resList, removeList):
|
|
|
+ '''
|
|
|
+ 删除重复的资源
|
|
|
+ '''
|
|
|
+ tree = ET.parse(resFile)
|
|
|
+ root = tree.getroot()
|
|
|
+
|
|
|
+ same = False
|
|
|
+ for node in root.getchildren():
|
|
|
+ if containRes(node, resList):
|
|
|
+ print('delete node : tag is %s, name is %s' % (node.tag, node.attrib['name']))
|
|
|
+ root.remove(node)
|
|
|
+ removeList.append(node)
|
|
|
+ same = True
|
|
|
+
|
|
|
+ if same:
|
|
|
+ tree.write(resFile, encoding)
|
|
|
+ return removeList
|
|
|
+
|
|
|
def removeSameRes(resFile, resList):
|
|
|
'''
|
|
|
删除重复的资源
|
|
@@ -450,11 +485,22 @@ def containRes(node, resList):
|
|
|
是否重复
|
|
|
'''
|
|
|
for item in resList:
|
|
|
- if item.tag == node.tag and item.attrib['name'] == node.attrib['name']:
|
|
|
+ if item.tag == node.tag and item.attrib['name'] == node.attrib['name']:
|
|
|
return True
|
|
|
|
|
|
return False
|
|
|
|
|
|
+def containPublic(node, removeList):
|
|
|
+ '''
|
|
|
+ 是否重复
|
|
|
+ '''
|
|
|
+ for item in removeList:
|
|
|
+ if item.tag == node.attrib['type'] and item.attrib['name'] == node.attrib['name']:
|
|
|
+ return True
|
|
|
+
|
|
|
+ return False
|
|
|
+
|
|
|
+
|
|
|
def removeRootAttr(manifest, attrType):
|
|
|
for key in namespaces:
|
|
|
ET.register_namespace(key, namespaces[key])
|