Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit distribution RECORD files instead of deleting them #28

Open
ncoghlan opened this issue Oct 21, 2024 · 0 comments
Open

Edit distribution RECORD files instead of deleting them #28

ncoghlan opened this issue Oct 21, 2024 · 0 comments
Labels
Category: Enhancement New feature or request

Comments

@ncoghlan
Copy link
Collaborator

Deleting distribution RECORD files entirely was the simplest way to resolve the issues they can cause with archive reproducibility: when they contain references to script files with shebangs that are rewritten at installation time, their contents are implicitly dependent on the absolute path to the build environment (since the shebang line gets rewritten).

An improved approach would be to delete just the lines corresponding to the deleted files, rather than deleting the entire RECORD file (as the current approach means that features like importlib.metadata.packages_distributions won't work in deployed environments).

To implement this approach, importlib.metadata can be used to get a complete list of every file belonging to every distribution in an environment, and the csv module can be used to edit the RECORD files (alternatively, for build time usage, the installer project offers a higher level interface for handling RECORD file updates in https://installer.pypa.io/en/latest/api/utils/#installer.utils.construct_record_file and https://installer.pypa.io/en/latest/api/records/).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant