Spaces:
Sleeping
Sleeping
Commit ·
3836283
1
Parent(s): 12e4183
Sync fixed PyInstaller spec (correct proxy datas/hiddenimports collection)
Browse files- tools/home_proxy_panel.spec +27 -23
tools/home_proxy_panel.spec
CHANGED
|
@@ -1,57 +1,61 @@
|
|
| 1 |
-
# PyInstaller spec for the TutorialMaker Home Proxy Panel.
|
| 2 |
#
|
| 3 |
# Build (on the SAME OS you want to target — PyInstaller does NOT cross-compile):
|
| 4 |
# pip install pyinstaller proxy.py huggingface_hub requests
|
| 5 |
# pyinstaller tools/home_proxy_panel.spec
|
| 6 |
# Output: dist/HomeProxyPanel(.exe)
|
| 7 |
#
|
| 8 |
-
#
|
| 9 |
-
#
|
| 10 |
-
#
|
| 11 |
-
# to ship it inside the exe instead, drop a `bore`/`bore.exe` next to this spec and add it
|
| 12 |
-
# to `datas` below.
|
| 13 |
import os
|
|
|
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
# SPECPATH is injected by PyInstaller = the directory holding this spec (…/tools).
|
| 18 |
_here = SPECPATH
|
| 19 |
_script = os.path.join(_here, "home_proxy_panel.py")
|
| 20 |
_bore = "bore.exe" if os.name == "nt" else "bore"
|
| 21 |
_bore_path = os.path.join(_here, _bore)
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
a = Analysis(
|
| 25 |
[_script],
|
| 26 |
pathex=[_here],
|
| 27 |
binaries=[],
|
| 28 |
datas=datas,
|
| 29 |
-
|
| 30 |
-
# analysis misses them — pull the whole package in.
|
| 31 |
-
hiddenimports=["proxy"],
|
| 32 |
hookspath=[],
|
| 33 |
hooksconfig={},
|
| 34 |
runtime_hooks=[],
|
| 35 |
excludes=[],
|
| 36 |
-
|
| 37 |
)
|
| 38 |
-
# Ensure proxy.py's data/plugin modules are collected.
|
| 39 |
-
try:
|
| 40 |
-
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
|
| 41 |
-
a.hiddenimports += collect_submodules("proxy")
|
| 42 |
-
a.datas += collect_data_files("proxy")
|
| 43 |
-
except Exception:
|
| 44 |
-
pass
|
| 45 |
|
| 46 |
-
pyz = PYZ(a.pure
|
| 47 |
|
| 48 |
exe = EXE(
|
| 49 |
-
pyz,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
name="HomeProxyPanel",
|
| 51 |
debug=False,
|
| 52 |
bootloader_ignore_signals=False,
|
| 53 |
strip=False,
|
| 54 |
upx=True,
|
|
|
|
| 55 |
runtime_tmpdir=None,
|
| 56 |
console=False, # windowed GUI app (no console)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
)
|
|
|
|
| 1 |
+
# PyInstaller spec for the TutorialMaker Home Proxy Panel (PyInstaller 6+).
|
| 2 |
#
|
| 3 |
# Build (on the SAME OS you want to target — PyInstaller does NOT cross-compile):
|
| 4 |
# pip install pyinstaller proxy.py huggingface_hub requests
|
| 5 |
# pyinstaller tools/home_proxy_panel.spec
|
| 6 |
# Output: dist/HomeProxyPanel(.exe)
|
| 7 |
#
|
| 8 |
+
# proxy.py is bundled and launched by the app re-invoking itself with the --run-proxy
|
| 9 |
+
# sentinel (see the __main__ guard in home_proxy_panel.py). `bore` is downloaded at
|
| 10 |
+
# runtime; to bundle it, drop a `bore`/`bore.exe` next to this spec and it's picked up.
|
|
|
|
|
|
|
| 11 |
import os
|
| 12 |
+
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
|
| 13 |
|
| 14 |
+
# SPECPATH is injected by PyInstaller = the directory holding this spec.
|
|
|
|
|
|
|
| 15 |
_here = SPECPATH
|
| 16 |
_script = os.path.join(_here, "home_proxy_panel.py")
|
| 17 |
_bore = "bore.exe" if os.name == "nt" else "bore"
|
| 18 |
_bore_path = os.path.join(_here, _bore)
|
| 19 |
+
|
| 20 |
+
# NOTE: collect_data_files / collect_submodules return the 2-tuple / name forms that
|
| 21 |
+
# Analysis() expects — pass them THROUGH Analysis, never append to a.datas (a 3-tuple TOC).
|
| 22 |
+
datas = collect_data_files("proxy")
|
| 23 |
+
if os.path.exists(_bore_path):
|
| 24 |
+
datas.append((_bore_path, "."))
|
| 25 |
+
hiddenimports = ["proxy"] + collect_submodules("proxy")
|
| 26 |
|
| 27 |
a = Analysis(
|
| 28 |
[_script],
|
| 29 |
pathex=[_here],
|
| 30 |
binaries=[],
|
| 31 |
datas=datas,
|
| 32 |
+
hiddenimports=hiddenimports,
|
|
|
|
|
|
|
| 33 |
hookspath=[],
|
| 34 |
hooksconfig={},
|
| 35 |
runtime_hooks=[],
|
| 36 |
excludes=[],
|
| 37 |
+
noarchive=False,
|
| 38 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
pyz = PYZ(a.pure)
|
| 41 |
|
| 42 |
exe = EXE(
|
| 43 |
+
pyz,
|
| 44 |
+
a.scripts,
|
| 45 |
+
a.binaries,
|
| 46 |
+
a.datas,
|
| 47 |
+
[],
|
| 48 |
name="HomeProxyPanel",
|
| 49 |
debug=False,
|
| 50 |
bootloader_ignore_signals=False,
|
| 51 |
strip=False,
|
| 52 |
upx=True,
|
| 53 |
+
upx_exclude=[],
|
| 54 |
runtime_tmpdir=None,
|
| 55 |
console=False, # windowed GUI app (no console)
|
| 56 |
+
disable_windowed_traceback=False,
|
| 57 |
+
argv_emulation=False,
|
| 58 |
+
target_arch=None,
|
| 59 |
+
codesign_identity=None,
|
| 60 |
+
entitlements_file=None,
|
| 61 |
)
|