-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.py
More file actions
64 lines (53 loc) · 1.65 KB
/
deploy.py
File metadata and controls
64 lines (53 loc) · 1.65 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
import os
from pathlib import Path
from shutil import copy, copytree
from distutils.sysconfig import get_python_lib
# https://blog.csdn.net/qq_25262697/article/details/129302819
# https://www.cnblogs.com/happylee666/articles/16158458.html
args = [
'nuitka',
'--standalone',
# '--windows-disable-console',
'--follow-import-to=app' ,
'--plugin-enable=pyqt5' ,
'--include-qt-plugins=sensible,styles' ,
'--msvc=latest',
'--show-memory' ,
'--show-progress' ,
'--windows-icon-from-ico=app/resource/images/logo.ico',
'--include-module=app',
'--nofollow-import-to=pywin,numpy,scipy,PIL,colorthief',
'--follow-import-to=win32com,win32gui,win32print,qfluentwidgets,app',
'--output-dir=dist/main',
'--onefile',
'main.py',
]
os.system(' '.join(args))
# copy site-packages to dist folder
dist_folder = Path("dist/main/main.dist")
site_packages = Path(get_python_lib())
copied_libs = []
for src in copied_libs:
src = site_packages / src
dist = dist_folder / src.name
print(f"Coping site-packages `{src}` to `{dist}`")
try:
if src.is_file():
copy(src, dist)
else:
copytree(src, dist)
except:
pass
# copy standard library
copied_files = ["ctypes", "hashlib.py", "hmac.py", "random.py", "secrets.py", "uuid.py"]
for file in copied_files:
src = site_packages.parent / file
dist = dist_folder / src.name
print(f"Coping stand library `{src}` to `{dist}`")
try:
if src.is_file():
copy(src, dist)
else:
copytree(src, dist)
except:
pass