-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.py
52 lines (41 loc) · 1.31 KB
/
build.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# -*- coding: utf-8 -*-
import os
import platform
version = '0.0.3'
def build_macos():
os.system('pyinstaller '
'--clean '
'--python="./venv/bin/python3" '
'--windowed '
'--noconfirm '
f'--name="LianJia-{version}-macos-arm64" '
'--hidden-import "lxml" '
'--hidden-import "pypinyin" '
'--icon="./static/image/logo.icns" '
'--add-data="static:static" '
'gui.py')
def build_windows():
os.system('pyinstaller '
'--clean '
'--python="./venv/bin/python3" '
'--windowed '
'--noconfirm '
f'--name="LianJia-{version}-windows-x86_64" '
'--hidden-import "lxml" '
'--hidden-import "pypinyin" '
'--icon="./static/image/logo.ico" '
'--add-data="static;static" '
'gui.py')
def main():
# 获取当前操作系统类型
current_os = platform.system().lower()
# 根据当前操作系统执行相应的打包操作
if current_os == 'darwin':
build_macos()
elif current_os == 'windows':
build_windows()
else:
print("Unsupported operating system.")
if __name__ == "__main__":
main()
print("build success......")