Skip to content

Preserve executable bit on package_data copied as modules - #5321

Open
MaxxxDong wants to merge 1 commit into
pypa:mainfrom
MaxxxDong:fix/preserve-package-data-mode
Open

MaxxxDong wants to merge 1 commit into
pypa:mainfrom
MaxxxDong:fix/preserve-package-data-mode

Conversation

@MaxxxDong

Copy link
Copy Markdown

Summary of changes

Fixes #5296.

Since setuptools 84.0.0, package_data files that are also Python modules (for example a nested scripts/*.py picked up as a PEP 420 package) lost their executable bit in wheels.

build_py copies those .py files first as modules with preserve_mode=False, then as package data with preserve_mode=True. v84 started writing nanosecond mtimes, so the second copy is skipped as up-to-date and the +x bit from the source never gets applied.

build_package_data now always applies the source permission bits after the copy (then make_writable, same as before).

Closes #5296

Pull Request Checklist

  • Changes have tests
  • News fragment added in [newsfragments/].

build_py copies nested .py package_data as modules with preserve_mode=False
first. After v84's nanosecond mtime copy, the later package_data copy is
skipped as up-to-date, so +x is dropped from wheels. Always apply the
source mode after that copy.
@mergify

mergify Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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.

[BUG] setuptools 84.0.0 no longer preserves executable bit on  package_data  files in wheels

1 participant