diff --git a/DTCPyinstaller.py b/DTCPyinstaller.py new file mode 100644 index 0000000..4779fc5 --- /dev/null +++ b/DTCPyinstaller.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +import re +import sys + + +from PyInstaller.__main__ import run + +# python DTCPyinstaller.py --clean -y DataCreating_Click.spec + +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$','',sys.argv[0]) + sys.exit(run()) diff --git a/DataCreating_Click.spec b/DataCreating_Click.spec index 4b01c2a..92808a0 100644 --- a/DataCreating_Click.spec +++ b/DataCreating_Click.spec @@ -29,7 +29,10 @@ exe = EXE(pyz, bootloader_ignore_signals=False, strip=False, upx=True, - console=False) + console=False, + icon='images/bjx.ico', + version="file_verison_info.txt" + ) coll = COLLECT(exe, diff --git a/file_verison_info.txt b/file_verison_info.txt new file mode 100644 index 0000000..49c893b --- /dev/null +++ b/file_verison_info.txt @@ -0,0 +1,44 @@ +# UTF-8 +# +# For more details about fixed file info 'ffi' see: +# http://msdn.microsoft.com/en-us/library/ms646997.aspx +VSVersionInfo( +ffi=FixedFileInfo( +# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) +# Set not needed items to zero 0. +filevers=(1, 0, 0, 0), # 文件版本 +prodvers=(1, 0, 0, 0), +# Contains a bitmask that specifies the valid bits 'flags'r +mask=0x3f, +# Contains a bitmask that specifies the Boolean attributes of the file. +flags=0x0, +# The operating system for which this file was designed. +# 0x4 - NT and there is no need to change it. +OS=0x4, +# The general type of file. +# 0x1 - the file is an application. +fileType=0x1, # 类型 +# The function of the file. +# 0x0 - the function is not defined for this fileType +subtype=0x0, +# Creation date and time stamp. +date=(0, 0) +), +kids=[ +StringFileInfo( + [ + StringTable( + u'040904B0', + [StringStruct(u'CompanyName', u'halliday'), + StringStruct(u'FileDescription', u'持续性生成数据'), # 文件说明 + StringStruct(u'FileVersion', u'1.0.0'), + StringStruct(u'InternalName', u'GIT'), + StringStruct(u'LegalCopyright', u'halliday版权所有'), #版权 + StringStruct(u'OriginalFilename', u'dataCreatingGUI.exe'), #原始文件名 + StringStruct(u'ProductName', u'dataCreatingGUI'), #产品名称 + StringStruct(u'ProductVersion', u'1.0.0')]) #产品版本 + ]), +VarFileInfo( + [VarStruct(u'Translation', [2052, 1200])]) # 语言 + ] +) diff --git a/images/bjx.ico b/images/bjx.ico new file mode 100644 index 0000000..98547fe Binary files /dev/null and b/images/bjx.ico differ diff --git a/release.py b/release.py index b4f25e7..c048890 100644 --- a/release.py +++ b/release.py @@ -70,24 +70,23 @@ def _strip_py(py_dir): def main(): # src_dir = sys.argv[1] - site_pacakge_dir = sys.argv[2] + pyinstaller_pacakge_dir = sys.argv[2] target_dir = sys.argv[3] top_dir = sys.argv[4] - shutil.rmtree(target_dir, ignore_errors=True) - os.makedirs(target_dir) + if os.path.isdir(top_dir): + shutil.rmtree(target_dir, ignore_errors=True) - for dir in ("bin", "etc"): + shutil.move(pyinstaller_pacakge_dir,target_dir) + + for dir in ("ui", "etc","images"): _copytree(os.path.join(top_dir, dir), os.path.join(target_dir, dir)) shutil.copy2(os.path.join(top_dir, "README.md"), os.path.join(target_dir, "README.md")) - target_lib_dir = os.path.join(target_dir, "lib") - _copytree(site_pacakge_dir, target_lib_dir) - _zip_file(target_dir) print("") diff --git a/requirements.txt b/requirements.txt index 6929b81..0a035eb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,5 @@ schedule==1.2.1 JPype1==1.4.1 JayDeBeApi==1.2.3 pyside6==6.1.3 +pyinstaller==6.4.0 diff --git a/tox.ini b/tox.ini index 00b02b0..f90f92f 100644 --- a/tox.ini +++ b/tox.ini @@ -24,5 +24,8 @@ deps = -r{toxinidir}/requirements.txt commands = - {envpython} {toxinidir}/release.py {envdir} {envsitepackagesdir} {toxinidir}/build/dataCreatingGUI_v1.0.0 {toxinidir} + # 先调用pyinstaller打包 + {envpython} {toxinidir}/DTCPyinstaller.py --clean -y DataCreating_Click.spec + # 整体打包 + {envpython} {toxinidir}/release.py {envdir} {toxinidir}/dist/dataCreatingGUI {toxinidir}/dist/dataCreatingGUI_v1.0.0 {toxinidir}