8000 fix: Ensure temporary .pyc & .pyo files are excluded from the interpr… · keith/rules_python@7f5a1b5 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 7f5a1b5

Browse files
mattemrickeylev
andauthored
fix: Ensure temporary .pyc & .pyo files are excluded from the interpreters repository files (bazel-contrib#2743)
We've seen cases the temporary versions for the `.pyc` and `.pyo` files are unstable on certain interpreter toolchains. The temp files take for form of `.pyc.NNN`, so the amended glob patten will still match both the `.pyc` and `.pyc.NNN` versions of the file names. --------- Co-authored-by: Richard Levasseur <richardlev@gmail.com>
1 parent 6854dc3 commit 7f5a1b5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Unreleased changes template.
9090
transitions transitioning on the `python_version` flag.
9191
Fixes [#2685](https://github.com/bazel-contrib/rules_python/issues/2685).
9292
* (toolchains) Run the check on the Python interpreter in isolated mode, to ensure it's not affected by userland environment variables, such as `PYTHONPATH`.
93+
* (toolchains) Ensure temporary `.pyc` and `.pyo` files are also excluded from the interpreters repository files.
9394

9495
{#v0-0-0-added}
9596
### Added

python/private/python_repository.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,9 @@ def _python_repository_impl(rctx):
193193
# Exclude them from the glob because otherwise between the first time and second time a python toolchain is used,"
194194
# the definition of this filegroup will change, and depending rules will get invalidated."
195195
# See https://github.com/bazel-contrib/rules_python/issues/1008 for unconditionally adding these to toolchains so we can stop ignoring them."
196-
"**/__pycache__/*.pyc",
197-
"**/__pycache__/*.pyo",
196+
# pyc* is ignored because pyc creation creates temporary .pyc.NNNN files
197+
"**/__pycache__/*.pyc*",
198+
"**/__pycache__/*.pyo*",
198199
]
199200

200201
if "windows" in platform:

0 commit comments

Comments
 (0)
0