Skip to content

run_guest_scene: take the Wine from $WINE when --wine is not given (OLD-10047) - #1239

Open
IlyassRS3 wants to merge 2 commits into
ProjectLeonida:mainfrom
IlyassRS3:carry/old-10047-run-guest-scene-wine
Open

IlyassRS3 wants to merge 2 commits into
ProjectLeonida:mainfrom
IlyassRS3:carry/old-10047-run-guest-scene-wine

Conversation

@IlyassRS3

@IlyassRS3 IlyassRS3 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Carries forward old-pr/10047 (draft #313, original commit by @SkippySteve) rebased cleanly onto main (2e026b03e), preserving the original author commit and adding a follow-up fix for native Windows:

  1. Original commit (@SkippySteve):
    • scripts/run_guest_scene.py: default --wine to $WINE when --wine is omitted (blank counts as unset; --wine still overrides), include the missing binary path in --wine: not found: ..., and update CLI/docstring messages.
    • tests/test_run_guest_scene_wine.py: 5 unit tests covering $WINE pickup, --wine-arg with $WINE, --wine overriding $WINE, missing/empty $WINE refusal outside Windows, and nonexistent $WINE reporting.
  2. Follow-up commit (df763ce9f, addressing @xel1uz's review):
    • scripts/run_guest_scene.py: only read $WINE as the default outside Windows (os.name != "nt"), qualify the docstring / --wine help text (default: $WINE outside Windows), and keep --wine-arg requires --wine on Windows.
    • tests/test_run_guest_scene_wine.py: add RunGuestSceneWindowsEnvTest (3 tests, runs on every platform via a SimpleNamespace stub on runner.os) confirming ambient WINE (existing or missing) is ignored on Windows, explicit --wine still works, and --wine-arg requires explicit --wine.

Item ID

Verification

Tested on macOS 27.2.1 (Apple M5 arm64), Python 3.14 (no game files, no GPU, standard library only):

  • TMPDIR=/var/tmp python3 -I tests/test_run_guest_scene_wine.py -v -> 8/8 OK (5 POSIX + 3 Windows-mode tests)
  • python3 -I tests/test_guest_scene_reference.py -v -> 6/6 OK
  • Mutation check vs HEAD~1 (without the Windows guard) -> FAILED (3 failures) across all 3 Windows ambient-WINE checks; mutation check vs main -> FAILED (3 failures, 2 errors); restoring HEAD returns to 8/8 OK.
  • python3 -m compileall -q scripts/run_guest_scene.py tests/test_run_guest_scene_wine.py -> OK
  • python3 -I scripts/check_no_game_data.py scripts/run_guest_scene.py tests/test_run_guest_scene_wine.py -> OK
  • python3 -I tests/test_ci_registration.py -> 15/15 OK
  • python3 -I tests/test_text_write_line_endings.py -> 3/3 OK

Checklist

  • No game files, binaries, shaders, textures, audio, or logs quoting them
  • No keys, decryption, or online services
  • Claimed in the coordination issue (Coordinating who works on what #14) before opening this PR
  • AI-assisted: yes (carried forward, audited, rebased, updated per review, and regression-verified with AI assistance; original commit by @SkippySteve preserved)

On Linux the script stopped at '--wine is required outside Windows' even
with WINE naming the Wine to use (e.g. UMU-Proton's files/bin/wine), while
run_wine_tests.py already defaults --wine to $WINE. --wine now defaults to
$WINE (blank counts as unset); --wine still wins when both are given.
Copilot AI balanced review requested due to automatic review settings November 24, 2026 20:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@xel1uz xel1uz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Linux precedence cases pass, but on native Windows an ambient WINE now changes a launch even when the caller omits --wine. With a missing binary the parser exits 2; with an existing one, the guest path builder prefixes an already native drive path with Z:. All five new Wine tests skip on Windows.

The inline change restored native paths in the Windows check while preserving the five Wine tests and six reference tests on Ubuntu. Please add a native-Windows regression case and qualify the CLI help accordingly. The original Wine change is draft #313; the description currently points to #312. AI-assisted review, CPU only.

Comment thread scripts/run_guest_scene.py Outdated
ap.add_argument("--shaders", type=Path, required=True, help="shader root containing spirv/")
ap.add_argument("--out", type=Path, help="new or empty folder (default: a temporary folder, removed afterwards)")
ap.add_argument("--wine", help="run the loader through this Wine binary")
ap.add_argument("--wine", default=os.environ.get("WINE") or None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the environment default on hosts that use Wine for the guest. An explicit --wine still takes precedence.

Suggested change
ap.add_argument("--wine", default=os.environ.get("WINE") or None,
ap.add_argument("--wine", default=(os.environ.get("WINE") or None) if os.name != "nt" else None,

@IlyassRS3

Copy link
Copy Markdown
Contributor Author

Thank you for catching that, @xel1uz! Pushed follow-up commit df763ce9f (preserving @SkippySteve's original commit):

  • Restricted the $WINE default to os.name != "nt", updated the docstring and --wine help text (default: $WINE outside Windows), and kept --wine-arg requires --wine on Windows.
  • Added RunGuestSceneWindowsEnvTest (3 tests, runs on both POSIX and Windows via a SimpleNamespace stub for runner.os) verifying that ambient WINE (existing or missing) is ignored on Windows, explicit --wine still takes precedence, and --wine-arg requires explicit --wine (verified 3 failures against HEAD~1, 8/8 OK on HEAD).
  • Fixed the draft PR reference in the description (#313).

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked the follow-up at df763ce9 on native Windows and Ubuntu under WSL. With the same inherited WINE pointing to a missing path and no explicit flag, the first PR head exited 2 on native Windows and the follow-up left the native launch selected. The three Windows cases passed, and all eight tests passed under Ubuntu. A separate CLI run on Ubuntu launched a synthetic wrapper from a relative WINE path containing spaces, forwarded --wine-arg, and preserved an explicit --wine override. The wrapper was launched after the runner switched into its output overlay.

AI-assisted review. CPU-only checks with synthetic inputs and launchers.

@xel1uz xel1uz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving df763ce9: the follow-up resolves what I requested.

  • Native Windows (Python 3.12, WINE set to a missing path, no --wine): tests/test_run_guest_scene_wine.py 8 tests OK (the 3 Windows-mode cases pass, the 5 POSIX cases skip), tests/test_guest_scene_reference.py 6/6 OK.
    • Bite check: with scripts/run_guest_scene.py from the first head (f3cd82af), the 3 Windows-mode cases fail.
      • Linux (Ubuntu 26.04, Python 3.14): both files OK on the PR head and on the PR merged with current main (merges without conflicts).
        AI-assisted review, CPU only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants