diff --git a/DTCPyinstaller.py b/DTCPyinstaller.py index 4779fc5..39cbc13 100644 --- a/DTCPyinstaller.py +++ b/DTCPyinstaller.py @@ -1,12 +1,25 @@ # -*- coding: utf-8 -*- import re import sys - +import shutil from PyInstaller.__main__ import run +from pathlib import Path # python DTCPyinstaller.py --clean -y DataCreating_Click.spec +def clean(): + # 清理目录 + path = Path(__file__) + build_dir = path.parent / "build" + dist_dir = path.parent / "dist" + if build_dir.exists(): + shutil.rmtree(build_dir) + if dist_dir.exists(): + shutil.rmtree(dist_dir) + + if __name__ == '__main__': + clean() sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$','',sys.argv[0]) sys.exit(run()) diff --git a/release.py b/release.py index c048890..95b38ca 100644 --- a/release.py +++ b/release.py @@ -55,7 +55,7 @@ def _copytree(src, dst, ignore=None): def _zip_file(target_dir): root_dir = os.path.dirname(target_dir) os.chdir(root_dir) - shutil.make_archive(os.path.basename(target_dir), format="gztar", + shutil.make_archive(os.path.basename(target_dir), format="zip", base_dir=os.path.basename(target_dir)) diff --git a/tox.ini b/tox.ini index f90f92f..c720661 100644 --- a/tox.ini +++ b/tox.ini @@ -25,7 +25,7 @@ deps = commands = # 先调用pyinstaller打包 - {envpython} {toxinidir}/DTCPyinstaller.py --clean -y DataCreating_Click.spec + {envpython} {toxinidir}/DTCPyinstaller.py DataCreating_Click.spec # 整体打包 {envpython} {toxinidir}/release.py {envdir} {toxinidir}/dist/dataCreatingGUI {toxinidir}/dist/dataCreatingGUI_v1.0.0 {toxinidir}