-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNekoCardReader.spec
More file actions
58 lines (52 loc) · 2.6 KB
/
Copy pathNekoCardReader.spec
File metadata and controls
58 lines (52 loc) · 2.6 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
# -*- mode: python ; coding: utf-8 -*-
# x64 onedir build; keep Qt/ANGLE software fallback available.
import os
from PyInstaller.utils.hooks import collect_submodules, collect_all
block_cipher = None
# 自带数据(存在才加)。只需要 felica.dll 一个 Sony 文件; SFCAccLib/SFCRep/SFCV 全不要。
_maybe = [
("app_icon.ico", "."),
("line_stations.yml", "."), # 中国 T-Union 站码(可缺, 运行时会下载)
("felica_runtime/felica.dll", "."), # 64 位 Sony FeliCa 库(打包脚本会拷进来)
("leaflet.js", "."), # Leaflet 地图库(本地内联, 避免每次开地图等 CDN)
("leaflet.css", "."),
]
datas = [(s, d) for (s, d) in _maybe if os.path.exists(s)]
binaries = []
hiddenimports = []
hiddenimports += collect_submodules("smartcard") # pyscard(中国卡 PC/SC)
hiddenimports += ["yaml", "matplotlib.backends.backend_qtagg",
"PyQt6.QtWebEngineWidgets", "PyQt6.QtWebEngineCore"]
# 本项目所有本地模块(很多是函数内 lazy import, 显式列出确保全部打进去)
hiddenimports += [
"paths", "settings", "fx", "web_map", "map_tiles", "history_store",
"card_reader", "felica_reader", "felica64_reader", "felica_suica",
"pboc_reader", "cn_read", "cn_data", "cn_lines", "cn_coords", "cn_network", "cn_trips",
"station_data", "station_db", "rail_route", "rail_geom", "jp_network",
"archive_widget", "trip_analytics", "yearbook_export", "data_portability",
"diagnostics", "plugin_registry", "offline_maps", "map_pipeline",
]
for _pkg in ("PyQt6.QtWebEngineWidgets", "PyQt6.QtWebEngineCore"):
try:
_d, _b, _h = collect_all(_pkg)
datas += _d; binaries += _b; hiddenimports += _h
except Exception:
pass
ICON = "app_icon.ico" if os.path.exists("app_icon.ico") else None
a = Analysis(
["main.py"], pathex=[], binaries=binaries, datas=datas,
hiddenimports=hiddenimports, hookspath=[], hooksconfig={}, runtime_hooks=[],
excludes=["tkinter"], win_no_prefer_redirects=False, win_private_assemblies=False,
cipher=block_cipher, noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
# onedir(文件夹版, 对地图 WebEngine 最稳)
exe = EXE(
pyz, a.scripts, [], exclude_binaries=True,
name="NekoCardReader", debug=False, bootloader_ignore_signals=False,
strip=False, upx=True, console=False,
disable_windowed_traceback=False, target_arch=None,
codesign_identity=None, entitlements_file=None, icon=ICON,
)
coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas,
strip=False, upx=True, upx_exclude=[], name="NekoCardReader")