fix(local-tool): ffmpeg zip 下載改用相對路徑

Windows 版 python.exe 不懂 MSYS2 的 /tmp 路徑語法,會拿著字面值 '/tmp/...'
去 Windows filesystem 找不到檔案。改下載到 vendor/ffmpeg/windows/ffmpeg-win.zip
相對路徑,bash 跟 python 都看得懂。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jim800121chen 2026-04-12 02:17:18 +08:00
parent a66fd5665b
commit 13ce654ac2

View File

@ -264,7 +264,7 @@ vendor-ffmpeg-windows: ## 下載 ffmpeg Windows static build → vendor/ffmpeg/w
else \
echo "==> 下載 ffmpeg Windows build from BtbN..."; \
echo "!! WARNING: BtbN 為 GPL buildlicense 由 PM 最終確認 !!"; \
curl -fL -o /tmp/ffmpeg-win.zip "$(FFMPEG_URL_WINDOWS)"; \
curl -fL -o vendor/ffmpeg/windows/ffmpeg-win.zip "$(FFMPEG_URL_WINDOWS)"; \
PY=""; \
for candidate in "$$VISIONA_PYTHON" "py -3" python3 python; do \
[ -z "$$candidate" ] && continue; \
@ -274,12 +274,12 @@ vendor-ffmpeg-windows: ## 下載 ffmpeg Windows static build → vendor/ffmpeg/w
done; \
if [ -z "$$PY" ]; then echo "ERROR: 需要真實 python 來解壓 zipWindowsApps stub 無法使用)"; exit 1; fi; \
echo "==> 使用 $$PY 解壓 ffmpeg zip"; \
$$PY -c "import zipfile, shutil; z=zipfile.ZipFile('/tmp/ffmpeg-win.zip'); \
$$PY -c "import zipfile, shutil; z=zipfile.ZipFile('vendor/ffmpeg/windows/ffmpeg-win.zip'); \
members=[n for n in z.namelist() if n.endswith('/bin/ffmpeg.exe')]; \
assert members, 'ffmpeg.exe not found in zip'; \
src=z.open(members[0]); dst=open('vendor/ffmpeg/windows/ffmpeg.exe','wb'); \
shutil.copyfileobj(src, dst); src.close(); dst.close(); z.close()" || { echo "ERROR: python 解壓失敗"; exit 1; }; \
rm -f /tmp/ffmpeg-win.zip; \
rm -f vendor/ffmpeg/windows/ffmpeg-win.zip; \
[ -f vendor/ffmpeg/windows/ffmpeg.exe ] || { echo "ERROR: ffmpeg.exe 沒被寫出"; exit 1; }; \
echo "==> ffmpeg.exe 大小:$$(du -sh vendor/ffmpeg/windows/ffmpeg.exe | cut -f1)"; \
fi