|
| 1 | +# -*- mode: python ; coding: utf-8 -*- |
| 2 | +# PyInstaller spec for the Vinted local worker shipped as a Tauri sidecar. |
| 3 | +# Build: |
| 4 | +# pyinstaller api/desktop_vinted_server.spec --noconfirm --clean |
| 5 | +# Output: ./dist/goupix-vinted-worker(.exe) |
| 6 | +# |
| 7 | +# Notes: |
| 8 | +# - On Windows we want `console=False` so launching the Tauri app does not pop a cmd window. |
| 9 | +# Logs are written to `%LOCALAPPDATA%\GoupixDex\logs\vinted-worker.log` (see desktop_vinted_server.py). |
| 10 | +# - `nodriver` and `uvicorn` heavily use lazy imports → declare them as hidden imports. |
| 11 | + |
| 12 | +from __future__ import annotations |
| 13 | + |
| 14 | +import os |
| 15 | +from pathlib import Path |
| 16 | + |
| 17 | +from PyInstaller.utils.hooks import collect_submodules, collect_data_files |
| 18 | + |
| 19 | +# `pyinstaller` exécute toujours le .spec depuis le répertoire courant ; on lance la commande |
| 20 | +# depuis `api/` (CI : `working-directory: api`, dev : `cd api && pyinstaller …`). |
| 21 | +SPEC_DIR = Path(os.getcwd()) |
| 22 | +if not (SPEC_DIR / "desktop_vinted_server.py").is_file(): |
| 23 | + candidate = Path(__file__).resolve().parent if "__file__" in globals() else None |
| 24 | + if candidate is not None and (candidate / "desktop_vinted_server.py").is_file(): |
| 25 | + SPEC_DIR = candidate |
| 26 | + else: |
| 27 | + raise RuntimeError( |
| 28 | + "desktop_vinted_server.spec doit être lancé depuis le dossier `api/` du dépôt." |
| 29 | + ) |
| 30 | + |
| 31 | +ENTRY_SCRIPT = str(SPEC_DIR / "desktop_vinted_server.py") |
| 32 | + |
| 33 | +hiddenimports = [] |
| 34 | +hiddenimports += collect_submodules("nodriver") |
| 35 | +hiddenimports += collect_submodules("uvicorn") |
| 36 | +hiddenimports += collect_submodules("anyio") |
| 37 | +hiddenimports += collect_submodules("httpx") |
| 38 | +hiddenimports += collect_submodules("services") |
| 39 | +hiddenimports += collect_submodules("services.vinted_wardrobe") |
| 40 | +hiddenimports += collect_submodules("core") |
| 41 | +hiddenimports += collect_submodules("schemas") |
| 42 | +hiddenimports += collect_submodules("models") |
| 43 | +hiddenimports += collect_submodules("app_types") |
| 44 | +hiddenimports += [ |
| 45 | + "pymysql", |
| 46 | + "bcrypt", |
| 47 | + "browser_cookie3", |
| 48 | + "vinted_scraper", |
| 49 | +] |
| 50 | + |
| 51 | +datas = [] |
| 52 | +datas += collect_data_files("nodriver", include_py_files=False) |
| 53 | + |
| 54 | +block_cipher = None |
| 55 | + |
| 56 | +a = Analysis( |
| 57 | + [ENTRY_SCRIPT], |
| 58 | + pathex=[str(SPEC_DIR)], |
| 59 | + binaries=[], |
| 60 | + datas=datas, |
| 61 | + hiddenimports=hiddenimports, |
| 62 | + hookspath=[], |
| 63 | + hooksconfig={}, |
| 64 | + runtime_hooks=[], |
| 65 | + excludes=[ |
| 66 | + "tkinter", |
| 67 | + "PIL.ImageTk", |
| 68 | + ], |
| 69 | + win_no_prefer_redirects=False, |
| 70 | + win_private_assemblies=False, |
| 71 | + cipher=block_cipher, |
| 72 | + noarchive=False, |
| 73 | +) |
| 74 | + |
| 75 | +pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) |
| 76 | + |
| 77 | +exe = EXE( |
| 78 | + pyz, |
| 79 | + a.scripts, |
| 80 | + a.binaries, |
| 81 | + a.zipfiles, |
| 82 | + a.datas, |
| 83 | + [], |
| 84 | + name="goupix-vinted-worker", |
| 85 | + debug=False, |
| 86 | + bootloader_ignore_signals=False, |
| 87 | + strip=False, |
| 88 | + upx=False, |
| 89 | + runtime_tmpdir=None, |
| 90 | + # `console=False` on Windows = no cmd window pops up when Tauri spawns the worker. |
| 91 | + # On macOS/Linux it has no visible effect (Tauri inherits no terminal anyway). |
| 92 | + console=False, |
| 93 | + disable_windowed_traceback=False, |
| 94 | + argv_emulation=False, |
| 95 | + target_arch=None, |
| 96 | + codesign_identity=None, |
| 97 | + entitlements_file=None, |
| 98 | +) |
0 commit comments