2 Star 13 Fork 5

wqhqq1/Python+PyQt5货物管理系统

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.py 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
wqhqq1 提交于 2023-05-21 15:46 +08:00 . reformat
import platform
import subprocess
import time
DEBUG_FEATURE_FLAG = False
JIEBA_LIB_DIR = 'jieba;jieba' if platform.system() == 'Windows' else 'jieba:jieba'
def installer():
print('[INFO] Checking System State...', end='')
if platform.system() == 'Darwin' or platform.system() == 'Windows':
print('ok.')
print('[INFO] Downloading requirements', end='')
p = subprocess.Popen(
['pip', 'install', '-r', 'requirements.txt', '-i',
'https://pypi.tuna.tsinghua.edu.cn/simple/'], stdout=subprocess.DEVNULL)
while True:
if p.poll() is None:
time.sleep(0.1)
print('.', end='')
continue
if p.poll() != 0:
print('[ERROR] Failed to install requirements!')
break
print('ok.')
print('[INFO] Building project', end='')
if DEBUG_FEATURE_FLAG:
p = subprocess.Popen(
['pyinstaller', '-F', 'main.py', '--hidden-import', 'jieba',
'--add-data', JIEBA_LIB_DIR])
else:
p = subprocess.Popen(
['pyinstaller', '-F', '--noconsole', 'main.py', '--hidden-import', 'jieba',
'--add-data', JIEBA_LIB_DIR])
while True:
if p.poll() is None:
time.sleep(0.1)
print('.', end='')
continue
break
print('ok. See binary file at dist/')
if platform.system() == 'Darwin':
subprocess.Popen(['chmod', '+x', 'dist/main'], stdout=subprocess.DEVNULL)
else:
print('[ERROR] Your platform is not supported yet!')
if __name__ == '__main__':
installer()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wqhqq1/goods-manager-python.git
git@gitee.com:wqhqq1/goods-manager-python.git
wqhqq1
goods-manager-python
Python+PyQt5货物管理系统
master

搜索帮助