script.py 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # coding:utf8
  2. __author__ = 'dong'
  3. import os
  4. import logging
  5. import xml.dom.minidom
  6. import re
  7. import shutil
  8. import glob
  9. from xml.etree.ElementTree import ElementTree, Element
  10. import distutils.dir_util
  11. from xml.etree import ElementTree as ET
  12. import gw_file_system
  13. import gw_data_center
  14. ANDROID_NS = 'http://schemas.android.com/apk/res/android'
  15. def script_init(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
  16. # gw_data_center.pack_small=True
  17. return
  18. def script_second(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
  19. logging.info('script_second: ' + str(channel_sdk_info))
  20. # 逆向渠道id
  21. if channel_sdk_info['id'] == '549':
  22. public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable/abc_item_background_holo_light.xml")
  23. if os.path.exists(public_xml):
  24. os.remove(public_xml)
  25. public_xml = os.path.join(extract_dir,
  26. "../sdk/smallsheep/ForRes/drawable-xhdpi/abc_ic_commit_search_api_mtrl_alpha.png")
  27. if os.path.exists(public_xml):
  28. os.remove(public_xml)
  29. public_xml = os.path.join(extract_dir,
  30. "../sdk/smallsheep/ForRes/drawable-xhdpi/abc_popup_background_mtrl_mult.9.png")
  31. if os.path.exists(public_xml):
  32. os.remove(public_xml)
  33. public_xml = os.path.join(extract_dir,
  34. "../sdk/smallsheep/ForRes/drawable-xxhdpi/abc_ab_share_pack_mtrl_alpha.9.png")
  35. if os.path.exists(public_xml):
  36. os.remove(public_xml)
  37. public_xml = os.path.join(extract_dir,
  38. "../sdk/smallsheep/ForRes/layout/abc_alert_dialog_material.xml")
  39. if os.path.exists(public_xml):
  40. os.remove(public_xml)
  41. public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
  42. handle_public_xml(public_xml, "abc_item_background_holo_light")
  43. public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
  44. handle_public_xml(public_xml, "abc_alert_dialog_material")
  45. public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/styles.xml")
  46. handle_public_xml(public_xml, "abc_alert_dialog_material")
  47. public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/styles.xml")
  48. handle_public_xml(public_xml, "abc_item_background_holo_light")
  49. def handle_public_xml(public_xml_path, remove_node):
  50. if not os.path.exists(public_xml_path):
  51. logging.info('public_xml is null: ' + public_xml_path)
  52. return
  53. new_lines = []
  54. with open(public_xml_path, 'r+') as f:
  55. for line in f.readlines():
  56. # l = line.strip()
  57. if line.find(remove_node) > -1:
  58. continue
  59. new_lines.append(line)
  60. f.seek(0)
  61. f.truncate()
  62. f.writelines(new_lines)
  63. return
  64. def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
  65. logging.info("-----debug-----")
  66. def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
  67. return
  68. if __name__ == '__main__':
  69. # replace_super_application("D:\work\wzdq")
  70. ""