Skip to content

fix(pypi): append .bat extension for rewritten shebang scripts in RECORD on Windows - #4114

Merged
rickeylev merged 9 commits into
bazel-contrib:mainfrom
rickeylev:fix_record_win_paths
Aug 28, 2026
Merged

fix(pypi): append .bat extension for rewritten shebang scripts in RECORD on Windows#4114
rickeylev merged 9 commits into
bazel-contrib:mainfrom
rickeylev:fix_record_win_paths

Conversation

@rickeylev

@rickeylev rickeylev commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

On Windows, wheel scripts with Python shebangs are rewritten as .bat
wrappers, but the generated RECORD file retained extensionless script
paths. This caused importlib.metadata file resolution and RECORD
verification to fail when locating installed scripts.

Pass the list of rewritten scripts from whl_library_srcs to
gen_wheel_record and update the RECORD rewriters to append .bat only to
those rewritten script entries on Windows.

  • Migrate importlib_metadata_test to pytest_test across Python 3.10-3.14
    and add Windows .bat verification.

Convert importlib_metadata_test from unittest to pytest and use the pytest_test rule. Also update assertions to expect .bat extensions for rewritten shebang scripts on Windows and verify all located files directly.
Configure python_versions to test importlib_metadata_test across Python 3.10 through 3.14.
…cord_rewriter_test

Update Windows RECORD expected output in wheel_record_rewriter_test so that .sh scripts without Python shebangs do not expect a .bat extension.
Configure target_compatible_with = SUPPORTS_BZLMOD for importlib_metadata_test since pytest_test dependencies require bzlmod.
…dows in RECORD files

On Windows, shebang-bin scripts are rewritten to .bat wrappers. Update wheel RECORD rewriters to append .bat for extensionless script entries.
During wheel RECORD generation on Windows, .bat should only be appended
to scripts that underwent shebang rewriting (those with #!python), rather
than all extensionless scripts.

Pass the list of rewritten scripts from whl_library_srcs to
gen_wheel_record and selectively append .bat in the rewriter.
@rickeylev
rickeylev marked this pull request as ready for review August 27, 2026 08:09
@rickeylev
rickeylev requested a review from aignas as a code owner August 27, 2026 08:09
@rickeylev
rickeylev enabled auto-merge August 27, 2026 08:10
@rickeylev rickeylev changed the title test(pypi): add tests verifying Windows RECORD script .bat extension fix(pypi): append .bat extension for rewritten shebang scripts in RECORD on Windows Aug 27, 2026
@rickeylev
rickeylev added this pull request to the merge queue Aug 28, 2026
Merged via the queue into bazel-contrib:main with commit 47e18b1 Aug 28, 2026
7 checks passed
@rickeylev
rickeylev deleted the fix_record_win_paths branch August 28, 2026 00:34
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.

2 participants