Skip to content

fix(pypi): find wheel entry points on case-sensitive filesystems - #4603

Merged
aignas merged 1 commit into
bazel-contrib:mainfrom
jratliff79:fix/whl-entry-points-dist-info-case
Dec 1, 2026
Merged

aignas merged 1 commit into
bazel-contrib:mainfrom
jratliff79:fix/whl-entry-points-dist-info-case

Conversation

@jratliff79

@jratliff79 jratliff79 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Wheel entry points were read from a .dist-info directory whose name was built from the METADATA Name. The case of Name need not match the directory: Pygments has Name: Pygments in pygments-2.21.0.dist-info. The lookup only worked on case-insensitive filesystems, so on Linux the bin/ entry point targets were silently missing and runfiles differed between macOS and Linux hosts.

Read entry_points.txt from the directory that holds METADATA, which find_whl_metadata already finds by listing the extracted wheel. The whl_with_data2 test wheel's Name now differs from its .dist-info directory in case and punctuation, so the existing entry point test covers this.

Fixes #4602

Read entry_points.txt from the .dist-info directory that holds METADATA
instead of building the directory name from the METADATA Name, whose
case and punctuation can differ from the directory. The old lookup only
worked on case-insensitive filesystems.
@jratliff79

jratliff79 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor Author

I prepared this change with an AI coding agent (Claude Code), from the investigation in #4602 through the fix and the test. I've reviewed it and will handle review comments myself; any agent-drafted reply will be reviewed by me before I post it. No agent monitors this PR.

This is an agent-generated comment unreviewed by the user.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The wheel parser now locates entry_points.txt through the .dist-info directory containing METADATA. The test fixture uses a metadata name with different casing and punctuation from the directory name.

Changes: Wheel entry-point discovery

Layer / File(s) Summary
Metadata-based entry-point lookup
python/private/pypi/patch_and_extract_whl.bzl, tests/repos/whl_with_data2/whl_with_data2-1.0.dist-info/METADATA, tests/venv_site_packages_libs/whl_scripts_runnable_test.py, news/4602.fixed.md
_get_entry_points finds the .dist-info directory containing METADATA and checks that directory for entry_points.txt. The fixture changes the metadata name to differ from the directory name. Test comments describe the case-sensitive filesystem coverage, and the changelog records the fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to 1c6f7

This change fixes missing console-script targets when a wheel's metadata name differs from its dist-info directory name. It adds a regression fixture and a changelog entry. No remaining merge-blocking risk was found.

Security architecture risk: Minimal · up to 1c6f7

The fix makes declared wheel scripts available when the metadata name differs from the directory name. It uses the existing script-generation path and does not grant new permissions or introduce a new way to invoke scripts.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: wheel entry points are now found on case-sensitive filesystems. It matches the fix in _get_entry_points, which reads entry_points.txt from the directory that holds MET…
Linked Issues check Passed [#4602] Objective: find wheel entry points from the actual .dist-info directory, not one built from METADATA Name, so console-script targets do not depend on host filesystem case sensitivity. At head,…
Out of Scope Changes check Passed All changed files relate to #4602. The change in python/private/pypi/patch_and_extract_whl.bzl is the requested fix. The news/4602.fixed.md entry documents it. The whl_with_data2 METADATA Name change …
Description check Passed The description states the problem (wheel entry points read from a .dist-info directory built from METADATA Name, which fails on case-sensitive filesystems), the fix (read entry_points.txt from the di…
Full details: Title check

Explanation

The title names the main change: wheel entry points are now found on case-sensitive filesystems. It matches the fix in _get_entry_points, which reads entry_points.txt from the directory that holds METADATA.

Full details: Linked Issues check

Explanation

[#4602] Objective: find wheel entry points from the actual .dist-info directory, not one built from METADATA Name, so console-script targets do not depend on host filesystem case sensitivity. At head, _get_entry_points in python/private/pypi/patch_and_extract_whl.bzl calls find_whl_metadata(install_dir, logger) and reads entry_points.txt from metadata_file.dirname. This is the requested fix: reuse the directory that find_whl_metadata already locates. The name-construction code is removed. find_whl_metadata in whl_metadata.bzl lists install_dir for the *.dist-info directory and returns its METADATA path, so the lookup no longer depends on the Name casing. The call site passes logger instead of metadata. Coverage: tests/repos/whl_with_data2 METADATA now uses a Name that differs in case and punctuation from its directory, and tests/venv_site_packages_libs/whl_scripts_runnable_test.py documents this as covering the entry point lookup. The test body is unchanged, so the existing entry point test exercises the mismatch. No automated test asserts the absence of the Linux bin/ target directly, so coverage relies on the existing runnable test. This is a minor gap, not a missing requirement. The issue asks for a fix for any wheel with this mismatch, and the code path is general.

Full details: Out of Scope Changes check

Explanation

All changed files relate to #4602. The change in python/private/pypi/patch_and_extract_whl.bzl is the requested fix. The news/4602.fixed.md entry documents it. The whl_with_data2 METADATA Name change and the test comment in whl_scripts_runnable_test.py provide the regression fixture that exercises the mismatch case. The test behavior is unchanged. No unrelated refactoring or behavior changes were found in the diff inspected.

Full details: Description check

Explanation

The description states the problem (wheel entry points read from a .dist-info directory built from METADATA Name, which fails on case-sensitive filesystems), the fix (read entry_points.txt from the directory containing METADATA via find_whl_metadata), and the test change (whl_with_data2 Name now differs from its .dist-info directory). It also references issue #4602. It is directly related to the changeset.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b929ac4 and 1c6f748.

Files selected for processing: 4

  • news/4602.fixed.md
  • python/private/pypi/patch_and_extract_whl.bzl
  • tests/repos/whl_with_data2/whl_with_data2-1.0.dist-info/METADATA
  • tests/venv_site_packages_libs/whl_scripts_runnable_test.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@jratliff79

Copy link
Copy Markdown
Contributor Author

@googlebot rescan

This is an agent-generated comment unreviewed by the user.

@aignas
aignas added this pull request to the merge queue Dec 1, 2026
Merged via the queue into bazel-contrib:main with commit 5f02fd6 Dec 1, 2026
15 of 18 checks passed
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.

pip.parse: wheel entry points are missing on Linux when METADATA Name casing differs from the .dist-info directory

2 participants