# -*- mode: python ; coding: utf-8 -*- import sys import shutil import os import tarfile sys.setrecursionlimit(5000) block_cipher = None #######begin-打包前处理############## #将上一级的tool文件夹替换到当前路径下的tool # 测试代码 cwdpath = os.getcwd() tool_path = '' src = '../tool' des = os.path.join(cwdpath, "tool") targz_path = os.path.join(cwdpath, "tool.tar.gz") #创建文件夹 if os.path.exists(des): if os.path.isdir(des): shutil.rmtree(des) os.makedirs(des) #压缩 dir = os.path.split(targz_path )[0] if os.path.exists(dir) is False: os.makedirs(dir) with tarfile.open(targz_path, "w:gz") as tar: tar.add(src, arcname=os.path.basename(src)) #解压 t = tarfile.open(targz_path) t.extractall(path=cwdpath) #删除临时压缩包 #os.remove(targz_path) #生成名称 main_name = '' for name in os.listdir(cwdpath): if 'Main.py' in name: main_name = name exe_name = exe_name = main_name .split('.')[0][:-4] + '-C-SAR-V2.1' #######end-打包前处理############## a = Analysis(['VegetationPhenologyMain.py', './tool/algorithm/algtools/CoordinateTransformation.py', './tool/algorithm/algtools/DEMJoint.py', './tool/algorithm/algtools/logHandler.py', './tool/algorithm/algtools/MetaDataHandler.py', './tool/algorithm/algtools/PreProcess.py', './tool/algorithm/algtools/RieveFilter.py', './tool/algorithm/algtools/ROIAlg.py', './tool/algorithm/algtools/ScatteringAuxData.py', './tool/algorithm/block/blockprocess.py', './tool/algorithm/image/ImageHandle.py', './tool/algorithm/xml/AlgXmlHandle.py', './tool/algorithm/xml/CreatMetafile.py', './tool/config/ConfigeHandle.py', './tool/logs/logHandler.py',], pathex=[cwdpath], binaries=[], datas=[], hiddenimports=[], hookspath=[], runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, noarchive=False) pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas, [], name='VegetationPhenology-C-SAR-V2.1', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, upx_exclude=[], runtime_tmpdir=None, console=True )