修改打包方式

This commit is contained in:
halliday2023 2024-02-14 10:56:02 +08:00
parent 577abe4d69
commit 96cab1dddb
3 changed files with 16 additions and 3 deletions

View File

@ -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())

View File

@ -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))

View File

@ -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}