Skip to content

Normalize RECORD paths when writing - #349

Open
ahmojo wants to merge 1 commit into
pypa:mainfrom
ahmojo:fix/158-record-forward-slashes
Open

Normalize RECORD paths when writing#349
ahmojo wants to merge 1 commit into
pypa:mainfrom
ahmojo:fix/158-record-forward-slashes

Conversation

@ahmojo

@ahmojo ahmojo commented Jul 5, 2026

Copy link
Copy Markdown

Summary

Fixes RECORD writing so Windows-style separators are normalized to forward slashes regardless of the platform doing the write.

What changed

  • Updated RecordEntry.to_row() to normalize the output path with PureWindowsPath(...).as_posix().
  • Added a focused regression test that simulates a non-Windows writer receiving a backslash path.
  • No new dependencies.

Why

RecordEntry.to_row() previously only replaced backslashes when os.sep == \. That meant a RecordEntry containing a Windows-style path could still write backslashes when serialized on another platform. RECORD paths should use / consistently.

Tests

  • python -m pytest tests/test_records.py::TestRecordEntry::test_string_representation_normalizes_backslash_path -q
  • python -m pytest tests/test_records.py -q
  • python -m ruff check src\installer\records.py tests\test_records.py
  • python -m ruff format --check src\installer\records.py tests\test_records.py
  • python -m nox -s test-3.14
  • python -m pre_commit run --files src\installer\records.py tests\test_records.py

Closes #158

@ahmojo
ahmojo marked this pull request as ready for review July 5, 2026 02:29
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.

Always normalize RECORD files to forward-slash when writing

1 participant