pyloid 0.20.2__py3-none-any.whl → 0.20.2.dev2__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- pyloid/__init__.py +7 -7
- pyloid/api.py +104 -104
- pyloid/autostart.py +101 -101
- pyloid/browser_window.py +1956 -1915
- pyloid/builder/__init__.py +80 -80
- pyloid/builder/build_config.schema.json +72 -72
- pyloid/builder/spec.py +266 -247
- pyloid/custom/titlebar.py +116 -116
- pyloid/filewatcher.py +163 -163
- pyloid/js_api/event_api.py +24 -24
- pyloid/js_api/window_api.py +255 -255
- pyloid/monitor.py +921 -921
- pyloid/pyloid.py +1404 -1404
- pyloid/thread_pool.py +500 -500
- pyloid/timer.py +307 -307
- pyloid/tray.py +48 -48
- pyloid/utils.py +122 -122
- {pyloid-0.20.2.dist-info → pyloid-0.20.2.dev2.dist-info}/LICENSE +201 -201
- {pyloid-0.20.2.dist-info → pyloid-0.20.2.dev2.dist-info}/METADATA +1 -1
- pyloid-0.20.2.dev2.dist-info/RECORD +21 -0
- pyloid-0.20.2.dist-info/RECORD +0 -21
- {pyloid-0.20.2.dist-info → pyloid-0.20.2.dev2.dist-info}/WHEEL +0 -0
pyloid/builder/spec.py
CHANGED
@@ -1,247 +1,266 @@
|
|
1
|
-
from pyloid.utils import get_platform
|
2
|
-
import json
|
3
|
-
from pathlib import Path
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
spec_path
|
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
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
)
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
"""
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
1
|
+
from pyloid.utils import get_platform
|
2
|
+
import json
|
3
|
+
from pathlib import Path
|
4
|
+
|
5
|
+
|
6
|
+
def create_spec_from_json(json_path):
|
7
|
+
with open(json_path, "r", encoding="utf-8") as f:
|
8
|
+
config = json.load(f)
|
9
|
+
|
10
|
+
os_type = get_platform()
|
11
|
+
|
12
|
+
if os_type == "macos":
|
13
|
+
spec_content = _create_macos_spec(config)
|
14
|
+
elif os_type == "linux":
|
15
|
+
spec_content = _create_linux_spec(config)
|
16
|
+
else: # windows
|
17
|
+
spec_content = _create_windows_spec(config)
|
18
|
+
|
19
|
+
spec_path = Path(f"build-{os_type}.spec")
|
20
|
+
spec_path.write_text(spec_content, encoding="utf-8")
|
21
|
+
|
22
|
+
return str(spec_path)
|
23
|
+
|
24
|
+
|
25
|
+
def _create_windows_spec(config):
|
26
|
+
bundle_type = config.get("bundle", {}).get("windows", "directory")
|
27
|
+
console = config.get("console", False)
|
28
|
+
|
29
|
+
base_spec = f"""# -*- mode: python ; coding: utf-8 -*-
|
30
|
+
|
31
|
+
block_cipher = None
|
32
|
+
|
33
|
+
a = Analysis(
|
34
|
+
['{config['main_script']}'],
|
35
|
+
pathex={config.get('pathex', [])},
|
36
|
+
binaries={config.get('binaries', [])},
|
37
|
+
datas={config.get('datas', [])},
|
38
|
+
hiddenimports={config.get('hiddenimports', [])},
|
39
|
+
hookspath={config.get('hookspath', [])},
|
40
|
+
hooksconfig={config.get('hooksconfig', {})},
|
41
|
+
runtime_hooks={config.get('runtime_hooks', [])},
|
42
|
+
excludes={config.get('excludes', [])},
|
43
|
+
win_no_prefer_redirects=False,
|
44
|
+
win_private_assemblies=False,
|
45
|
+
cipher=block_cipher,
|
46
|
+
noarchive=False
|
47
|
+
)
|
48
|
+
|
49
|
+
pyz = PYZ(a.pure, a.zipped_data,
|
50
|
+
cipher=block_cipher)
|
51
|
+
"""
|
52
|
+
|
53
|
+
if bundle_type == "onefile":
|
54
|
+
return (
|
55
|
+
base_spec
|
56
|
+
+ f"""
|
57
|
+
exe = EXE(
|
58
|
+
pyz,
|
59
|
+
a.scripts,
|
60
|
+
a.binaries,
|
61
|
+
a.zipfiles,
|
62
|
+
a.datas,
|
63
|
+
[],
|
64
|
+
name='{config.get("name", "pyloid-app")}',
|
65
|
+
debug=False,
|
66
|
+
bootloader_ignore_signals=False,
|
67
|
+
strip=False,
|
68
|
+
upx=True,
|
69
|
+
upx_exclude=[],
|
70
|
+
runtime_tmpdir=None,
|
71
|
+
console={console},
|
72
|
+
disable_windowed_traceback=False,
|
73
|
+
argv_emulation=False,
|
74
|
+
target_arch=None,
|
75
|
+
codesign_identity=None,
|
76
|
+
entitlements_file=None,
|
77
|
+
icon='{config.get('icon', 'src-pyloid/icons/icon.ico')}'
|
78
|
+
)
|
79
|
+
"""
|
80
|
+
)
|
81
|
+
else:
|
82
|
+
return (
|
83
|
+
base_spec
|
84
|
+
+ f"""
|
85
|
+
exe = EXE(
|
86
|
+
pyz,
|
87
|
+
a.scripts,
|
88
|
+
[],
|
89
|
+
exclude_binaries=True,
|
90
|
+
name='{config.get("name", "pyloid-app")}',
|
91
|
+
debug=False,
|
92
|
+
bootloader_ignore_signals=False,
|
93
|
+
strip=False,
|
94
|
+
upx=True,
|
95
|
+
console={console},
|
96
|
+
disable_windowed_traceback=False,
|
97
|
+
argv_emulation=False,
|
98
|
+
target_arch=None,
|
99
|
+
codesign_identity=None,
|
100
|
+
entitlements_file=None,
|
101
|
+
icon='{config.get('icon', 'src-pyloid/icons/icon.ico')}'
|
102
|
+
)
|
103
|
+
|
104
|
+
coll = COLLECT(
|
105
|
+
exe,
|
106
|
+
a.binaries,
|
107
|
+
a.zipfiles,
|
108
|
+
a.datas,
|
109
|
+
strip=False,
|
110
|
+
upx=True,
|
111
|
+
upx_exclude=[],
|
112
|
+
name='{config.get("name", "pyloid-app")}'
|
113
|
+
)
|
114
|
+
"""
|
115
|
+
)
|
116
|
+
|
117
|
+
|
118
|
+
def _create_macos_spec(config):
|
119
|
+
console = config.get("console", False)
|
120
|
+
return f"""# -*- mode: python ; coding: utf-8 -*-
|
121
|
+
|
122
|
+
a = Analysis(
|
123
|
+
['{config['main_script']}'],
|
124
|
+
pathex={config.get('pathex', [])},
|
125
|
+
binaries={config.get('binaries', [])},
|
126
|
+
datas={config.get('datas', [])},
|
127
|
+
hiddenimports={config.get('hiddenimports', [])},
|
128
|
+
hookspath={config.get('hookspath', [])},
|
129
|
+
hooksconfig={config.get('hooksconfig', {})},
|
130
|
+
runtime_hooks={config.get('runtime_hooks', [])},
|
131
|
+
excludes={config.get('excludes', [])},
|
132
|
+
noarchive=False,
|
133
|
+
optimize=0
|
134
|
+
)
|
135
|
+
|
136
|
+
pyz = PYZ(a.pure)
|
137
|
+
|
138
|
+
exe = EXE(
|
139
|
+
pyz,
|
140
|
+
a.scripts,
|
141
|
+
[],
|
142
|
+
exclude_binaries=True,
|
143
|
+
name='{config.get("name", "pyloid-app")}',
|
144
|
+
debug=False,
|
145
|
+
bootloader_ignore_signals=False,
|
146
|
+
strip=False,
|
147
|
+
upx=True,
|
148
|
+
console={console},
|
149
|
+
disable_windowed_traceback=False,
|
150
|
+
argv_emulation=False,
|
151
|
+
target_arch=None,
|
152
|
+
codesign_identity=None,
|
153
|
+
entitlements_file=None,
|
154
|
+
icon='{config.get('icon', 'src-pyloid/icons/icon.ico')}'
|
155
|
+
)
|
156
|
+
|
157
|
+
coll = COLLECT(
|
158
|
+
exe,
|
159
|
+
a.binaries,
|
160
|
+
a.datas,
|
161
|
+
strip=False,
|
162
|
+
upx=True,
|
163
|
+
upx_exclude=[],
|
164
|
+
name='{config.get("name", "pyloid-app")}'
|
165
|
+
)
|
166
|
+
|
167
|
+
app = BUNDLE(
|
168
|
+
coll,
|
169
|
+
name='{config.get("name", "pyloid-app")}.app',
|
170
|
+
icon='{config.get('icon', 'src-pyloid/icons/icon.icns')}',
|
171
|
+
bundle_identifier=None
|
172
|
+
)
|
173
|
+
"""
|
174
|
+
|
175
|
+
|
176
|
+
def _create_linux_spec(config):
|
177
|
+
bundle_type = config.get("bundle", {}).get("linux", "directory")
|
178
|
+
console = config.get("console", False)
|
179
|
+
|
180
|
+
base_spec = f"""# -*- mode: python ; coding: utf-8 -*-
|
181
|
+
|
182
|
+
block_cipher = None
|
183
|
+
|
184
|
+
a = Analysis(
|
185
|
+
['{config['main_script']}'],
|
186
|
+
pathex={config.get('pathex', [])},
|
187
|
+
binaries={config.get('binaries', [])},
|
188
|
+
datas={config.get('datas', [])},
|
189
|
+
hiddenimports={config.get('hiddenimports', [])},
|
190
|
+
hookspath={config.get('hookspath', [])},
|
191
|
+
hooksconfig={config.get('hooksconfig', {})},
|
192
|
+
runtime_hooks={config.get('runtime_hooks', [])},
|
193
|
+
excludes={config.get('excludes', [])},
|
194
|
+
win_no_prefer_redirects=False,
|
195
|
+
win_private_assemblies=False,
|
196
|
+
cipher=block_cipher,
|
197
|
+
noarchive=False
|
198
|
+
)
|
199
|
+
|
200
|
+
pyz = PYZ(a.pure, a.zipped_data,
|
201
|
+
cipher=block_cipher)
|
202
|
+
"""
|
203
|
+
|
204
|
+
if bundle_type == "onefile":
|
205
|
+
return (
|
206
|
+
base_spec
|
207
|
+
+ f"""
|
208
|
+
exe = EXE(
|
209
|
+
pyz,
|
210
|
+
a.scripts,
|
211
|
+
a.binaries,
|
212
|
+
a.zipfiles,
|
213
|
+
a.datas,
|
214
|
+
[],
|
215
|
+
name='{config.get("name", "pyloid-app")}',
|
216
|
+
debug=False,
|
217
|
+
bootloader_ignore_signals=False,
|
218
|
+
strip=False,
|
219
|
+
upx=True,
|
220
|
+
upx_exclude=[],
|
221
|
+
runtime_tmpdir=None,
|
222
|
+
console={console},
|
223
|
+
disable_windowed_traceback=False,
|
224
|
+
argv_emulation=False,
|
225
|
+
target_arch=None,
|
226
|
+
codesign_identity=None,
|
227
|
+
entitlements_file=None,
|
228
|
+
icon='{config.get('icon', 'src-pyloid/icons/icon.png')}'
|
229
|
+
)
|
230
|
+
"""
|
231
|
+
)
|
232
|
+
else:
|
233
|
+
return (
|
234
|
+
base_spec
|
235
|
+
+ f"""
|
236
|
+
exe = EXE(
|
237
|
+
pyz,
|
238
|
+
a.scripts,
|
239
|
+
[],
|
240
|
+
exclude_binaries=True,
|
241
|
+
name='{config.get("name", "pyloid-app")}',
|
242
|
+
debug=False,
|
243
|
+
bootloader_ignore_signals=False,
|
244
|
+
strip=False,
|
245
|
+
upx=True,
|
246
|
+
console={console},
|
247
|
+
disable_windowed_traceback=False,
|
248
|
+
argv_emulation=False,
|
249
|
+
target_arch=None,
|
250
|
+
codesign_identity=None,
|
251
|
+
entitlements_file=None,
|
252
|
+
icon='{config.get('icon', 'src-pyloid/icons/icon.png')}'
|
253
|
+
)
|
254
|
+
|
255
|
+
coll = COLLECT(
|
256
|
+
exe,
|
257
|
+
a.binaries,
|
258
|
+
a.zipfiles,
|
259
|
+
a.datas,
|
260
|
+
strip=False,
|
261
|
+
upx=True,
|
262
|
+
upx_exclude=[],
|
263
|
+
name='{config.get("name", "pyloid-app")}'
|
264
|
+
)
|
265
|
+
"""
|
266
|
+
)
|