-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui.spec
More file actions
105 lines (93 loc) · 2.74 KB
/
ui.spec
File metadata and controls
105 lines (93 loc) · 2.74 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
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
98
99
100
101
102
103
104
105
# -*- 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()
for x in possible_site_packages_dir:
print(str(x))
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]
# Add all the system qml files
qml_dir = os.path.join(site_packages_dir, "PyQt5", qt5folder, "qml")
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,
)
)
for plugin in ["sqldrivers"]:
bin_files.append(
(
f"{site_packages_dir}/PyQt5/{qt5folder}/plugins/{plugin}",
plugin,
)
)
for dll in glob.glob(f"{site_packages_dir}/PyQt5/{qt5folder}/bin/*.dll"):
bin_files.append((dll, "."))
# for dll in [ 'libeay32.dll', 'qt5quick.dll', 'qt5sql.dll' ]:
# if os.path.exists(f"{site_packages_dir}/PyQt5/{qt5folder}/bin/"+dll):
# bin_files.append((f"{site_packages_dir}/PyQt5/{qt5folder}/bin/"+dll,'.'))
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")
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
exclude_binaries=True,
name="cpmqdir",
debug=False,
strip=False,
upx=True,
console=False,
icon="ui/icon.ico",
)
coll = COLLECT(
exe,
a.binaries,
Tree("ui", prefix="ui/"),
a.zipfiles,
a.datas,
strip=False,
upx=True,
name="cpmqdir",
)