Make running from source work on Linux and macOS (fixes #2, #3) - #7
Open
TinNK3 wants to merge 1 commit into
Open
Make running from source work on Linux and macOS (fixes #2, #3)#7TinNK3 wants to merge 1 commit into
TinNK3 wants to merge 1 commit into
Conversation
Fixesnotepower2k1#2 and notepower2k1#3. The repository ships Windows binaries in `bin/` (`ffmpeg.exe`, `ffprobe.exe`) and those files are present after a clone on every platform. Linux and macOS therefore resolved a PE image as the FFmpeg path and failed at exec time, and several other Windows-only code paths raised before the editor could open. Path resolution - `runtime_paths` gains `tool_path()` / `ffmpeg_path()` / `ffprobe_path()`. Bundled copies still win so packaged Windows builds stay self-contained; elsewhere the `.exe` spelling is rejected outright and the tool is taken from PATH, falling back to the bare name for a readable "not found" error. - `bin_path()` strips a trailing `.exe` off-Windows, so the existing call sites keep working. Windows resolution is unchanged. - All FFmpeg/FFprobe lookups across app/ and ui/ now go through the helpers instead of hardcoding `.exe`. libmpv - `prepare_mpv_bundle()` no longer raises when `bin/mpv` is absent. Windows keeps pre-loading the bundled DLL; Linux/macOS defer to the system libmpv that python-mpv already discovers, and a bundled `.so`/`.dylib` is added to the loader path when one is present. - The startup asset check reports the system installation instead of failing on a missing `libmpv-2.dll`. Other Windows-only calls - `os.startfile` is Windows-only and raised AttributeError on the four "open folder" actions. They now share `open_path_externally()`, which uses QDesktopServices elsewhere — the guard the launcher already used. - Subtitle rendering looks in the platform font directories rather than only `%WINDIR%\Fonts`. Dependencies and docs - `onnxruntime-gpu` has no macOS wheel and no non-x86_64 wheel, so `pip install -r requirements-local.txt` failed outright on macOS. Markers now select the CPU `onnxruntime` there; exactly one is installed per platform. - README and docs/requirements.md cover the Linux/macOS prerequisites. Verified: Windows resolution is byte-identical before and after; a simulated POSIX host rejects the bundled `.exe` and resolves from PATH; pyflakes reports no new findings. The packaged release build and CUDA pack remain Windows-only. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes#2 (Cannot run on Linux).
Closes#3 ([Feature] Feature Request Support for Macos).
The problem
bin/contains committed Windows binaries (ffmpeg.exe,ffprobe.exe), and those files are present after a clone on every platform.bin_path("ffmpeg", "ffmpeg.exe")therefore resolved successfully on Linux and macOS and handed a PE image tosubprocess, which fails at exec time. A few other Windows-only code paths raised before the editor could open.This PR removes those blockers so
python ui/gui.pyruns from source on Linux and macOS using system FFmpeg and libmpv. Windows behaviour is unchanged — bundled binaries still win, so packaged builds stay self-contained.Changes
Path resolution (
app/runtime_paths.py)tool_path()/ffmpeg_path()/ffprobe_path(). Bundled copy first; off-Windows the.exespelling is rejected outright and the tool comes fromPATH, degrading to the bare name sosubprocessraises a readable "not found" instead of us passing a path that does not exist.bin_path()strips a trailing.exeoff-Windows, so existing call sites keep working.app/andui/now goes through the helpers instead of hardcoding.exe.libmpv (
ui/utils/media_backend.py,ui/worker_adapters/processing_workers.py)prepare_mpv_bundle()no longer raisesFileNotFoundErrorwhenbin/mpvis absent. Windows keeps pre-loading the bundled DLL; Linux/macOS defer to the system libmpv thatpython-mpvalready discovers, and a bundled.so/.dylibis added to the loader path if one exists.libmpv-2.dll.Windows-only API calls
os.startfiledoes not exist off-Windows and raisedAttributeErroron the four "open folder" actions. They now shareopen_path_externally(), which falls back toQDesktopServices— the same guardlauncher.pyalready used.%WINDIR%\Fonts.Dependencies (
requirements-base.txt)onnxruntime-gpuhas no macOS wheel and no non-x86_64 wheel on PyPI, sopip install -r requirements-local.txtfailed outright on macOS before anything else could be tried. Environment markers now select the CPUonnxruntimethere.Docs — README and
docs/requirements.mdgained the Linux/macOS prerequisites and avenvactivation note.Verification
ffmpeg.exe/ffprobe.exestill selected;bin_path()unchanged)..exe, resolves fromPATH, prefers an extension-less bundled binary when present, and findslibmpv.2.dylib.onnxruntimemarkers were evaluated across win-x64 / linux-x64 / linux-arm / mac-arm / mac-x64 — exactly one package installs on each.compileallclean;pyflakesreports no new findings versusmain.Scope and caveats
I do not have a Linux or macOS machine, so I could not do a full end-to-end run there — please treat the runtime side as needing a smoke test from someone who can reproduce the original reports. Explicitly out of scope: the packaged
.exebuild, the CUDA runtime pack, and GPU mode on macOS all remain Windows/NVIDIA-only. This PR targets "runs from source", not "ships a Linux/macOS release".