-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdesktop_vinted_server.spec
More file actions
103 lines (92 loc) · 3.33 KB
/
desktop_vinted_server.spec
File metadata and controls
103 lines (92 loc) · 3.33 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
# -*- mode: python ; coding: utf-8 -*-
# PyInstaller spec for the Vinted local worker shipped as a Tauri sidecar.
# Build:
# pyinstaller api/desktop_vinted_server.spec --noconfirm --clean
# Output: ./dist/goupix-vinted-worker(.exe)
#
# Notes:
# - On Windows we want `console=False` so launching the Tauri app does not pop a cmd window.
# Logs are written to `%LOCALAPPDATA%\GoupixDex\logs\vinted-worker.log` (see desktop_vinted_server.py).
# - `nodriver` and `uvicorn` heavily use lazy imports → declare them as hidden imports.
from __future__ import annotations
import os
from pathlib import Path
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
# `pyinstaller` exécute toujours le .spec depuis le répertoire courant ; on lance la commande
# depuis `api/` (CI : `working-directory: api`, dev : `cd api && pyinstaller …`).
SPEC_DIR = Path(os.getcwd())
if not (SPEC_DIR / "desktop_vinted_server.py").is_file():
candidate = Path(__file__).resolve().parent if "__file__" in globals() else None
if candidate is not None and (candidate / "desktop_vinted_server.py").is_file():
SPEC_DIR = candidate
else:
raise RuntimeError(
"desktop_vinted_server.spec doit être lancé depuis le dossier `api/` du dépôt."
)
ENTRY_SCRIPT = str(SPEC_DIR / "desktop_vinted_server.py")
hiddenimports = []
hiddenimports += collect_submodules("nodriver")
hiddenimports += collect_submodules("uvicorn")
hiddenimports += collect_submodules("anyio")
hiddenimports += collect_submodules("httpx")
hiddenimports += collect_submodules("services")
hiddenimports += collect_submodules("services.vinted_wardrobe")
hiddenimports += collect_submodules("core")
hiddenimports += collect_submodules("schemas")
hiddenimports += collect_submodules("models")
hiddenimports += collect_submodules("app_types")
hiddenimports += [
"pymysql",
"bcrypt",
"browser_cookie3",
"vinted_scraper",
]
datas = []
datas += collect_data_files("nodriver", include_py_files=False)
# `vinted_scraper` ships JSON data (e.g. utils/agents.json); PyInstaller does not include it by default.
datas += collect_data_files("vinted_scraper", include_py_files=False)
# Bundled Vinted (Chrome) defaults for the sidecar; CI may overwrite before PyInstaller.
if (SPEC_DIR / "worker_bundled.env").is_file():
datas += [(str(SPEC_DIR / "worker_bundled.env"), ".")]
block_cipher = None
a = Analysis(
[ENTRY_SCRIPT],
pathex=[str(SPEC_DIR)],
binaries=[],
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[
"tkinter",
"PIL.ImageTk",
],
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,
a.binaries,
a.zipfiles,
a.datas,
[],
name="goupix-vinted-worker",
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
runtime_tmpdir=None,
# `console=False` on Windows = no cmd window pops up when Tauri spawns the worker.
# On macOS/Linux it has no visible effect (Tauri inherits no terminal anyway).
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)