修改打包方式
This commit is contained in:
parent
577abe4d69
commit
96cab1dddb
|
@ -1,12 +1,25 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
import shutil
|
||||||
|
|
||||||
from PyInstaller.__main__ import run
|
from PyInstaller.__main__ import run
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
# python DTCPyinstaller.py --clean -y DataCreating_Click.spec
|
# 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__':
|
if __name__ == '__main__':
|
||||||
|
clean()
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$','',sys.argv[0])
|
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$','',sys.argv[0])
|
||||||
sys.exit(run())
|
sys.exit(run())
|
||||||
|
|
|
@ -55,7 +55,7 @@ def _copytree(src, dst, ignore=None):
|
||||||
def _zip_file(target_dir):
|
def _zip_file(target_dir):
|
||||||
root_dir = os.path.dirname(target_dir)
|
root_dir = os.path.dirname(target_dir)
|
||||||
os.chdir(root_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))
|
base_dir=os.path.basename(target_dir))
|
||||||
|
|
||||||
|
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -25,7 +25,7 @@ deps =
|
||||||
|
|
||||||
commands =
|
commands =
|
||||||
# 先调用pyinstaller打包
|
# 先调用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}
|
{envpython} {toxinidir}/release.py {envdir} {toxinidir}/dist/dataCreatingGUI {toxinidir}/dist/dataCreatingGUI_v1.0.0 {toxinidir}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue