81 lines
2.5 KiB
Python
81 lines
2.5 KiB
Python
import glob
|
|
import os
|
|
import shutil
|
|
from tool.file.fileHandle import fileHandle
|
|
file =fileHandle()
|
|
|
|
cwdpath = os.getcwd()
|
|
|
|
EXE_NAME = 'VegetationHeight'
|
|
Polar_Mode = 'L-SAR'
|
|
Version = 'V2.1'
|
|
File_NAME = EXE_NAME + '-' +Polar_Mode + '-' + Version
|
|
OUT_PATH = r'I:\MicroWorkspace\exe_file/' + File_NAME
|
|
base_list = ['model_meta.xml',
|
|
'config.ini',
|
|
EXE_NAME + '.xml',
|
|
'版本更新说明.txt']
|
|
exe_list = ['freeman_decomposition_T3.exe',
|
|
'h_a_alpha_decomposition_T3.exe',
|
|
'h_a_alpha_eigenvalue_set_T3.exe',
|
|
'h_a_alpha_eigenvector_set_T3.exe',
|
|
'lee_refined_filter_T3.exe',
|
|
'yamaguchi_4components_decomposition_T3.exe']
|
|
|
|
height_list = ['alos_calc_baseline.exe',
|
|
'boxcar_filter_T6.exe',
|
|
'complex_coherence_estimation.exe',
|
|
'complex_coherence_estimation_T6.exe',
|
|
'complex_coherence_opt_estimation.exe',
|
|
'complex_coherence_opt_estimation_T6.exe',
|
|
'config.yaml',
|
|
'config.ymal',
|
|
'data_convert_MLK_S2_T6.exe',
|
|
'file_boxcar.exe',
|
|
'flat_earth_removal_Slave.exe',
|
|
'forest_height_estimation.exe',
|
|
'height_estimation_inversion_procedure_RVOG.exe',
|
|
'PolSARproSim_FE_Kz.exe',
|
|
'vegetaheight.yaml'
|
|
]
|
|
dependence_list = base_list + height_list
|
|
|
|
|
|
def del_dump():
|
|
#删除多余文件夹
|
|
file.del_folder(cwdpath +'/dist')
|
|
file.del_folder(cwdpath +'/build')
|
|
file.del_folder(cwdpath +'/tool')
|
|
# file.del_folder(cwdpath +'/run_log')
|
|
if os.path.exists(cwdpath +'/tool.tar.gz'):
|
|
os.remove(cwdpath +'/tool.tar.gz')
|
|
|
|
def get_dll_list():
|
|
src_dir = '../exe_denpendence/dll'
|
|
return list(glob.glob(os.path.join(src_dir, '*.*')))
|
|
|
|
if __name__ == '__main__':
|
|
|
|
del_dump()
|
|
# 执行打包脚本
|
|
cmd = 'pyinstaller -D pyinstaller.spec'
|
|
result = os.system(cmd)
|
|
print("result:" + str(result))
|
|
if result == 0:
|
|
# 拷贝依赖库
|
|
dst_dir = './dist/' # 目的路径记得加斜杠
|
|
dll_list = get_dll_list()
|
|
file_list = dll_list + dependence_list
|
|
for srcfile in file_list:
|
|
file.copyfile2dir(srcfile, dst_dir)
|
|
#移动到指定目录下
|
|
shutil.move('./dist', OUT_PATH)
|
|
os.startfile(OUT_PATH)
|
|
|
|
#拷贝文件到指定文件夹
|
|
del_dump()
|
|
print("完成打包!")
|
|
|
|
|
|
|