script.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. # coding:utf8
  2. import os
  3. import logging
  4. ANDROID_NAMESPACE = 'http://schemas.android.com/apk/res/android'
  5. logger = logging.getLogger('script.py')
  6. def script_last(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
  7. public_xml = os.path.join(extract_dir, "res/values/public.xml")
  8. handle_public_xml(public_xml, "app_icon_round")
  9. handle_public_xml(public_xml, "icon_name")
  10. handle_public_xml(public_xml, "icon_name_round")
  11. def handle_public_xml(public_xml_path, remove_node):
  12. if not os.path.exists(public_xml_path):
  13. logging.info('public_xml is null: ' + public_xml_path)
  14. return
  15. new_lines = []
  16. with open(public_xml_path, 'r+') as f:
  17. for line in f.readlines():
  18. # l = line.strip()
  19. if line.find(remove_node) > -1:
  20. continue
  21. new_lines.append(line)
  22. f.seek(0)
  23. f.truncate()
  24. f.writelines(new_lines)
  25. return
  26. if __name__ == '__main__':
  27. script_last('', 'E:/script_test', {}, {}, {})