# -*- mode: python ; coding: utf-8 -*- from __future__ import annotations from pathlib import Path block_cipher = None spec_path = Path(SPECPATH).resolve() root = spec_path.parent.parent if spec_path.suffix == ".spec" else spec_path.parent def tree_datas(source: str, dest: str, suffixes: tuple[str, ...] | None = None): base = root / source items = [] if not base.exists(): return items for path in base.rglob("*"): if not path.is_file(): continue parts = set(path.parts) if "__pycache__" in parts: continue if path.suffix.lower() in {".pyc", ".pyo"}: continue if suffixes and path.suffix.lower() not in suffixes: continue rel_parent = path.parent.relative_to(base) items.append((str(path), str(Path(dest) / rel_parent))) return items datas = [] datas += tree_datas("pixiv_app/webui", "pixiv_app/webui", (".html", ".css", ".js", ".png", ".jpg", ".jpeg", ".webp", ".svg", ".ico")) datas += [ (src, dst) for src, dst in tree_datas("plugins", "plugins", (".py", ".json", ".md", ".txt")) if not any( marker in src for marker in ( "plugins\\ao3", "plugins/ao3", "plugins\\changpei", "plugins/changpei", "plugins\\taobao", "plugins/taobao", ) ) ] datas += [(str(root / "build_assets" / "app_icon.ico"), "build_assets")] hiddenimports = [ "pixiv_app.core.fingerprint", "pixiv_app.core.browser_proxy_pool", "PIL", "PIL.Image", "cryptography", "cryptography.hazmat.primitives", "cryptography.hazmat.primitives.padding", "cryptography.hazmat.primitives.ciphers", "customtkinter", "requests", "httpx", "playwright", "playwright.async_api", "playwright.sync_api", "pixiv_app.core.playwright_runtime", "pixiv_app.services.x_login_flow", ] a = Analysis( [str(root / "main.py")], pathex=[str(root)], binaries=[], datas=datas, hiddenimports=hiddenimports, hookspath=[], hooksconfig={}, runtime_hooks=[], excludes=[ "pytest", "unittest", "tkinter.test", ], 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="sakuradownloader", debug=False, bootloader_ignore_signals=False, strip=False, upx=True, upx_exclude=[], runtime_tmpdir=None, console=False, disable_windowed_traceback=False, argv_emulation=False, target_arch=None, codesign_identity=None, entitlements_file=None, icon=str(root / "build_assets" / "app_icon.ico"), )