1 Star 1 Fork 2

PyQt5/PDMs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
setup.py 2.35 KB
一键复制 编辑 原始数据 按行查看 历史
macoh_yan 提交于 2022-01-22 11:07 . 终稿
import sys
import os
from cx_Freeze import setup, Executable
from src.config import version_
sys.path.append(r'../')
include_files = ['src', 'config.ini']
excludes_packages = ["tkinter", "test", 'unittest', 'multiprocessing', 'msilib', 'lib2to3', '_distutils_hack',
'greenlet', 'html', 'http', 'importlib_metadata', 'pydoc_data', 'setuptools', 'pkg_resources',
'libcrypto-1_1']
packages = ['PyQt5', 'numpy', 'pandas', 'pymysql', 'sqlalchemy', 'configobj']
base = 'Win32GUI' if sys.platform == 'win32' else None
options = {
'build_exe': {
# 'includes': ["pandas", "numpy", "openpyxl"],
'include_files': include_files,
'packages': packages,
"excludes": excludes_packages,
}
}
executables = [
Executable('PDMs.py', base=base, icon='icon/logo.ico'),
]
def transform(path, flag):
for file in os.listdir(path):
if os.path.isfile(os.path.join(path, file)) and os.path.splitext(file)[-1] == '.py' or file in flag:
os.remove(os.path.join(path, file))
print('deleting {}'.format(os.path.join(path, file)))
elif os.path.isdir(os.path.join(path, file)) and file == '__pycache__':
for pyc_file in os.listdir(os.path.join(path, file)):
pyc_file_path = os.path.join(path, file, pyc_file)
if os.path.isfile(pyc_file_path) and os.path.splitext(pyc_file)[-1] == '.pyc':
rename = pyc_file.replace('.cpython-39', '', 1)
os.rename(pyc_file_path, os.path.join(path, rename))
print('moving {} to {}'.format(os.path.join(path, rename), pyc_file_path))
for root, dirs, files in os.walk(path):
for _dir in dirs:
if not os.listdir(os.path.join(root, _dir)):
os.rmdir(os.path.join(root, _dir))
def customer():
# 自定义函数
print('transforming py to pyc ...')
print('deleting py files...')
transform('build\\exe.win-amd64-3.9\\src', [])
transform('build\\exe.win-amd64-3.9\\PyQt5.uic.widget-plugins', [])
transform('build\\exe.win-amd64-3.9\\lib\\\PyQt5', ['python3.dll', 'python39.dll'])
setup(
name="PDMs",
options=options,
author='YanMing',
version=version_,
executables=executables,
author_email='[email protected]',
description="Product Data Management System",
zip_safe=False
)
customer()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/macho_yan/PDMs.git
[email protected]:macho_yan/PDMs.git
macho_yan
PDMs
PDMs
master

搜索帮助