script.py 937 B

1234567891011121314151617181920212223242526272829303132
  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. def handle_public_xml(public_xml_path, remove_node):
  10. if not os.path.exists(public_xml_path):
  11. logging.info('public_xml is null: ' + public_xml_path)
  12. return
  13. new_lines = []
  14. with open(public_xml_path, 'r+') as f:
  15. for line in f.readlines():
  16. # l = line.strip()
  17. if line.find(remove_node) > -1:
  18. continue
  19. new_lines.append(line)
  20. f.seek(0)
  21. f.truncate()
  22. f.writelines(new_lines)
  23. return
  24. if __name__ == '__main__':
  25. script_last('', 'E:/script_test', {}, {}, {})