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