Skip to content

awc_shorts: name a missing source as typed, not through repr() (EGEN-AWC-SHORTS-PATHREPR) - #6647

Merged
shayderrr merged 2 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/5-awc-shorts-pathrepr
Nov 23, 2026
Merged

shayderrr merged 2 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/5-awc-shorts-pathrepr

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

tools/awc_shorts.py refuses a missing source with one line, but that line ran the path through !r. repr() doubles every backslash, so on Windows the message was

awc_shorts: error: source does not exist: 'C:\\tmp\\nope\\missing.awc'

which cannot be pasted back into a shell, and it disagrees with the --out line nine lines below it (cannot create {a.out}), which already prints its path as typed. The other tools whose messages were fixed for the same reason are #5927.

What changed

  • tools/awc_shorts.py: the missing-source line prints {a.src}, not {a.src!r}.
  • tests/test_awc_shorts.py: a test that the path as built by the test (an absolute path inside a temporary folder) appears in the one stderr line.

Test

python -I tests/test_awc_shorts.py
  • Before the change (parent commit daf572c66~1, file restored with git checkout): FAIL: test_missing_source_names_the_path_as_typed, Ran 14 tests, FAILED (failures=1), exit 1.
  • After the change: Ran 14 tests, OK, exit 0.

Reproduction with the CLI, before and after:

python -I tools/awc_shorts.py 'C:\tmp\nope\missing.awc' 'C:\tmp\nope\out'
# before: awc_shorts: error: source does not exist: 'C:\\tmp\\nope\\missing.awc'
# after:  awc_shorts: error: source does not exist: C:\tmp\nope\missing.awc

The test bites on Windows only (the path has no backslash on Linux), which is where the doubled backslashes appeared; it passes on Linux both ways.

No GPU and no game files: the test builds its bank in the fixture, and the reproduction only names a path that does not exist.

Notes

EGEN-AWC-SHORTS-PATHREPR

AI-assisted.

The one ERROR line for a missing input ran the path through !r, so every backslash was doubled on Windows (C:\\\\Users\\\\...) and the path could not be pasted back. The --out line beside it already prints its path as typed, and so do the other tools whose messages were fixed the same way (ItsNotRexed#5927).
Fails on Windows before the fix in the parent commit (repr() turns C:\\a\\b into C:\\\\a\\\\b, so the plain path is not a substring); passes after it, and on Linux both ways since the path has no backslash there.

@LAKSHYA-cmd-tech LAKSHYA-cmd-tech 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.

Independent review on Windows 11 x64, Python 3.12.

  • Red-first verification on Windows: On parent revision with !r, missing in awc_shorts: error: source does not exist: contains doubled backslashes (\\), failing test_missing_source_names_the_path_as_typed. On head without !r, the path matches as typed.
  • python -I -m compileall -q tools/awc_shorts.py tests/test_awc_shorts.py (exit 0)
  • python -I tests/test_awc_shorts.py (14/14 passed)
  • python -I tools/awc_shorts.py --help (exit 0)
  • python -I scripts/check_no_game_data.py (exit 0)
  • git diff --check clean (0).

LGTM. AI-assisted; synthetic tests only, no game files or GPU used.

@kapitche

Copy link
Copy Markdown
Contributor

Tested 58df695 merged with main 8575d36 on Windows/Python 3.13.1 and Linux/Python 3.12.16: pass

Merge was clean (tools/awc_shorts.py, tests/test_awc_shorts.py).

Windows, 3.13.1 (worktree of main with the PR merged):

  • python -I tests\test_awc_shorts.py: Ran 15 tests, OK (skipped=1).
  • Negative control (tools/awc_shorts.py restored from main): FAILED (failures=1), test_missing_source_names_the_path_as_typed. PR version restored afterwards.

Linux, 3.12.16:

  • python -I tests/test_awc_shorts.py: Ran 15 tests, OK. With tools/awc_shorts.py from main it also passes (Ran 15 tests, OK), so on Linux the new test does not discriminate: a POSIX path has no backslashes for repr() to double, and assertIn(missing, ...) still matches inside the quotes. The test only means something on Windows.

Diff read: one change, {a.src!r} to {a.src} in the "source does not exist" message.

@shayderrr shayderrr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary
tools/awc_shorts.py::main now prints a missing source as {a.src} rather than {a.src!r}, so Windows paths keep single backslashes and can be pasted back into a shell; test_missing_source_names_the_path_as_typed asserts the message.

Why merge
The repr() form doubled backslashes and disagreed with the neighboring --out error line. Focused message fix matching the style used by earlier tool cleanups.

Verdict: Approve

@shayderrr

Copy link
Copy Markdown
Collaborator

Summary
tools/awc_shorts.py::main now prints a missing source as {a.src} rather than {a.src!r}, so Windows paths keep single backslashes and can be pasted back into a shell; test_missing_source_names_the_path_as_typed asserts the message.

Why merge
The repr() form doubled backslashes and disagreed with the neighboring --out error line. Focused message fix matching the style used by earlier tool cleanups.

Verdict: Approve

@shayderrr
shayderrr merged commit 7541333 into ItsNotRexed:main Nov 23, 2026
0 of 2 checks passed
Kosmabb8 added a commit to Kosmabb8/Leonida that referenced this pull request Nov 23, 2026
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.

4 participants