-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdeploy.py
More file actions
63 lines (52 loc) · 1.51 KB
/
deploy.py
File metadata and controls
63 lines (52 loc) · 1.51 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
import os
import sysconfig
from pathlib import Path
from shutil import copy, copytree
# https://blog.csdn.net/qq_25262697/article/details/129302819
# https://www.cnblogs.com/happylee666/articles/16158458.html
args = [
'nuitka',
'--standalone',
'--assume-yes-for-downloads',
'--mingw64',
'--windows-icon-from-ico=./app/resource/images/logo.ico',
'--enable-plugins=pyqt6',
'--show-memory',
'--show-progress',
'--windows-console-mode=disable',
'--output-dir=./build',
'--nofollow-import-to=plugins',
'--no-deployment-flag=excluded-module-usage',
'--include-package=yaml',
'--include-data-dir=app/resource=app/resource',
'./main.py'
]
os.system(' '.join(args))
# copy site-packages to dist folder
dist_folder = Path("build/main.dist")
site_packages = Path(sysconfig.get_paths()["purelib"])
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