-
Notifications
You must be signed in to change notification settings - Fork 19
/
deeplc.spec
132 lines (115 loc) · 2.87 KB
/
deeplc.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# -*- mode: python ; coding: utf-8 -*-
import os
import sys
from PyInstaller.building.build_main import Analysis, PYZ, EXE, COLLECT, BUNDLE, TOC
import PyInstaller.utils.hooks
import importlib.metadata
exe_name = 'deeplc'
script_name = 'deeplc/__main__.py'
#if sys.platform[:6] == "darwin":
# icon = 'deeplc_logo.icns'
#else:
# icon = 'deeplc_logo.ico'
block_cipher = None
location = os.getcwd()
project = "deeplc"
remove_tests = True
bundle_name = "deeplc"
#bundle_identifier = f"{bundle_name}.{deeplc.__version__}"
requirements = {
req.split()[0] for req in importlib.metadata.requires(project)
}
requirements.add(project)
requirements.add("sklearn")
requirements.add("sklearn.utils")
requirements.add("sklearn.neighbors")
requirements.add("sklearn.tree")
requirements.add("distributed")
hidden_imports = set()
datas = []
binaries = []
checked = set()
while requirements:
requirement = requirements.pop()
checked.add(requirement)
if requirement in ["pywin32"]:
continue
try:
module_version = importlib.metadata.version(requirement)
except (
importlib.metadata.PackageNotFoundError,
ModuleNotFoundError,
ImportError
):
continue
try:
datas_, binaries_, hidden_imports_ = PyInstaller.utils.hooks.collect_all(
requirement,
include_py_files=True
)
except ImportError:
continue
datas += datas_
# binaries += binaries_
hidden_imports_ = set(hidden_imports_)
if "" in hidden_imports_:
hidden_imports_.remove("")
if None in hidden_imports_:
hidden_imports_.remove(None)
requirements |= hidden_imports_ - checked
hidden_imports |= hidden_imports_
if remove_tests:
hidden_imports = sorted(
[h for h in hidden_imports if "tests" not in h.split(".")]
)
else:
hidden_imports = sorted(hidden_imports)
hidden_imports = [h for h in hidden_imports if "__pycache__" not in h]
datas = [d for d in datas if ("__pycache__" not in d[0]) and (d[1] not in [".", "build","dist","Output"])]
block_cipher = None
a = Analysis(
[script_name],
pathex=[location],
binaries=binaries,
datas=datas,
hiddenimports=hidden_imports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False
)
pyz = PYZ(
a.pure,
a.zipped_data,
cipher=block_cipher
)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='deeplc',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name=exe_name
)