Skip to content

fix: make windows ignore pycs in runtime#1715

Merged
aignas merged 2 commits intobazel-contrib:mainfrom
rickeylev:fix.windows.ignore.pyc
Jan 23, 2024
Merged

fix: make windows ignore pycs in runtime#1715
aignas merged 2 commits intobazel-contrib:mainfrom
rickeylev:fix.windows.ignore.pyc

Conversation

@rickeylev
Copy link
Copy Markdown
Collaborator

The downloaded runtimes don't contain pyc files, which means Python tries to create them at runtime, and thus the set of files in the runtime changes. This normally just silently affects cache hits, but on Windows can result is errors. This is because Windows has stricter file access semantics (e.g. a file can't be deleted if its still opened) and the way Python programs are built involves a step to zip everything up (which then requires the pyc to exist to be put into the zip file).

To fix, always ignore pyc files for Windows hosts. This should prevent those files from being picked up by the glob and being considered part of the runtime.

The downloaded runtimes don't contain pyc files, which means Python
tries to create them at runtime, and thus the set of files in the
runtime changes. This normally just silently affects cache hits, but
on Windows can result is errors. This is because Windows has stricter
file access semantics (e.g. a file can't be deleted if its still opened)
and the way Python programs are built involves a step to zip everything
up (which then requires the pyc to exist to be put into the zip file).

To fix, always ignore pyc files for Windows hosts. This should prevent
those files from being picked up by the glob and being considered part
of the runtime.
@rickeylev rickeylev requested a review from aignas January 23, 2024 00:20
@rickeylev rickeylev requested a review from f0rmiga as a code owner January 23, 2024 00:20
@rickeylev rickeylev added this pull request to the merge queue Jan 23, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jan 23, 2024
@rickeylev rickeylev added this pull request to the merge queue Jan 23, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Jan 23, 2024
@aignas aignas enabled auto-merge January 23, 2024 06:55
@aignas aignas added this pull request to the merge queue Jan 23, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 23, 2024
@aignas aignas added this pull request to the merge queue Jan 23, 2024
Merged via the queue into bazel-contrib:main with commit a64e55b Jan 23, 2024
@rickeylev rickeylev deleted the fix.windows.ignore.pyc branch January 24, 2024 21:24
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