Repository navigation
fix(toolchains): exclude pycache symlinks from runtime files - #4233
Open
stevendee-recon wants to merge 1 commit into
Open
stevendee-recon wants to merge 1 commit into
stevendee-recon wants to merge 1 commit into
Conversation
The runtime's `lib/**` glob matches the `__pycache__` symlinks added in bazel-contrib#3661, so they end up in runfiles. With `RULES_PYTHON_PYCACHE_DIR=/dev/null` they are symlinks to a character device, and packaging a binary into a tar layer fails (bazel-contrib#4198). The glob now excludes `__pycache__` and everything under it. The pyc cache is now keyed on the runtime archive's sha256 rather than a hash of the workspace root. The sources in an archive all share one mtime, so Python's mtime-and-size check can't tell a patch release's sources from the previous one's. The workspace hash didn't keep workspaces apart anyway: the repository contents cache shares one fetched runtime, symlinks included, across workspaces. The default root stops trying locations that are likely to be shared and instead tries a more reliably user-owned fallback: if `XDG_CACHE_HOME` is unset, then on non-Windows, `$HOME/.cache` is used (per [XDG][0]). On Windows, `%LOCALAPPDATA%` is used. (NB. [`platformdirs`][1] would choose `rules_python\Cache` rather than `rules_python_pycache`; the current change opts for one directory name everywhere.) [0]: https://specifications.freedesktop.org/basedir/latest/#variables [1]: https://platformdirs.readthedocs.io/en/latest/
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The runtime's
lib/**glob matches the__pycache__symlinks added in #3661, so they end up in runfiles.With
RULES_PYTHON_PYCACHE_DIR=/dev/nullthey are symlinks to a character device, and packaging a binary into a tar layer fails (#4198). The glob now excludes__pycache__and everything under it.The pyc cache is now keyed on the runtime archive's sha256 rather than a hash of the workspace root. The sources in an archive all share one mtime, so Python's mtime-and-size check can't tell a patch release's sources from the previous one's. The workspace hash didn't keep workspaces apart anyway: the repository contents cache shares one fetched runtime, symlinks included, across workspaces.
The default root stops trying locations that are likely to be shared and instead tries a more reliably user-owned fallback: if
XDG_CACHE_HOMEis unset, then on non-Windows,$HOME/.cacheis used (per XDG). On Windows,%LOCALAPPDATA%is used. (NB.platformdirswould chooserules_python\Cacherather thanrules_python_pycache; the current change opts for one directory name everywhere.)