-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui-single.spec
97 lines (86 loc) · 2.53 KB
/
ui-single.spec
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# -*- mode: python -*-
block_cipher = None
import os, site
from distutils.sysconfig import get_python_lib
import glob
qt5folder = "Qt5"
possible_site_packages_dir = [get_python_lib()] + site.getsitepackages()
possible_site_packages_dir = list(
filter(
lambda x: os.path.exists(os.path.join(x, "PyQt5", qt5folder, "qml")),
possible_site_packages_dir,
)
)
site_packages_dir = possible_site_packages_dir[0]
qml_dir = os.path.join(site_packages_dir, "PyQt5", qt5folder, "qml")
print("qml_dir=" + qml_dir)
added_files = [
(os.path.join(qml_dir, "QtQuick"), "_qml/QtQuick"),
(os.path.join(qml_dir, "QtQuick.2"), "_qml/QtQuick.2"),
]
bin_files = []
for lib in ["libQt5Quick", "libQt5Sql"]:
for found in glob.glob(f"{site_packages_dir}/PyQt5/{qt5folder}/lib/" + lib + ".*"):
bin_files.append((found, "."))
plugin_dest = "qt5_plugins"
if os.name == "nt":
plugin_dest = f"PyQt5/{qt5folder}/plugins"
for plugin in ["egldeviceintegrations", "xcbglintegrations", "sqldrivers"]:
if os.path.exists(f"{site_packages_dir}/PyQt5/{qt5folder}/plugins/" + plugin):
bin_files.append(
(
f"{site_packages_dir}/PyQt5/{qt5folder}/plugins/" + plugin,
plugin_dest + "/" + plugin,
)
)
if os.name != "nt":
bin_files.append(
(
f"{site_packages_dir}/PyQt5/{qt5folder}/plugins/" + plugin,
f"PyQt5/{qt5folder}/plugins/" + plugin,
)
)
for plugin in ["sqldrivers"]:
bin_files.append(
(
f"{site_packages_dir}/PyQt5/{qt5folder}/plugins/" + plugin,
plugin,
)
)
bin_files.append(
(glob.glob(site_packages_dir + "/scrypt.libs/libcrypto-*")[0], ".")
)
#bin_files.append(
# (glob.glob(site_packages_dir + "/scrypt.libs/libz-*")[0], ".")
#)
a = Analysis(
["ui.py"],
pathex=[os.getcwd()],
binaries=bin_files,
datas=added_files,
hiddenimports=["queue"],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
)
a.binaries.append(
("_scrypt", glob.glob(site_packages_dir + "/_scrypt*")[0], "EXTENSION")
)
print("site_packages=" + site_packages_dir)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
Tree("ui", prefix="ui/"),
a.zipfiles,
a.datas,
name="cpmq",
debug=False,
strip=False,
upx=True,
console=True,
)