makesoc.py 909 B

1234567891011121314151617181920212223242526272829
  1. import os
  2. import sys
  3. import shutil
  4. import urllib
  5. out_path='./'
  6. bin_file_name='rtthread.bin'
  7. pack_path='./pack'
  8. out_file='./rtthread_air105'
  9. cwd_path = os.getcwd()
  10. if __name__=='__main__':
  11. print(cwd_path)
  12. if os.path.exists(out_file+'.soc'):
  13. os.remove(out_file+'.soc')
  14. if not os.path.exists(pack_path+'/bootloader.bin'):
  15. urllib.urlretrieve("http://cdndownload.openluat.com/rt-thread/airm2m/air105/bootloader.bin", pack_path+'/bootloader.bin')
  16. if not os.path.exists(pack_path+'/soc_download.exe'):
  17. urllib.urlretrieve("http://cdndownload.openluat.com/rt-thread/airm2m/air105/soc_download.exe", pack_path+'/soc_download.exe')
  18. shutil.copy(out_path+bin_file_name, pack_path+'/'+bin_file_name)
  19. shutil.make_archive(out_file, 'zip', root_dir=pack_path)
  20. os.remove(pack_path+'/'+bin_file_name)
  21. os.rename(out_file+'.zip',out_file+'.soc')
  22. print('end')