From 9ef6a9f3778fb2ebbb9f93ceedb46d1d0d8d9b52 Mon Sep 17 00:00:00 2001 From: Dang Pham Date: Wed, 2 Sep 2026 13:04:08 +0700 Subject: [PATCH] Normalize RECORD paths when writing --- src/installer/records.py | 3 +-- tests/test_records.py | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/installer/records.py b/src/installer/records.py index 9bb45c75..b0adf88d 100644 --- a/src/installer/records.py +++ b/src/installer/records.py @@ -106,8 +106,7 @@ def to_row(self, path_prefix: str | None = None) -> tuple[str, str, str]: path = self.path # Convert Windows paths to use / for consistency - if os.sep == "\\": - path = path.replace("\\", "/") # pragma: no cover + path = path.replace("\\", "/") return ( path, diff --git a/tests/test_records.py b/tests/test_records.py index a6816081..eee3aa9e 100644 --- a/tests/test_records.py +++ b/tests/test_records.py @@ -176,6 +176,11 @@ def test_string_representation_with_prefix( ) assert record.to_row("prefix/") == expected_row + def test_to_row_normalizes_windows_path_on_any_platform(self): + record = RecordEntry.from_elements(r"package\module.py", "", "") + + assert record.to_row() == ("package/module.py", "", "") + def test_equality(self): record = RecordEntry.from_elements( "file.py",