diff options
author | Richard Levasseur <rlevasseur@google.com> | 2023-06-13 12:11:25 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-13 19:11:25 +0000 |
commit | 68db9553946b6ad83e820e1297dddb9502601f8f (patch) | |
tree | 8390242902755955bb4135086c65513f262d7d24 | |
parent | 9ffb1ecd9b4e46d2a0bca838ac80d7128a352f9f (diff) | |
download | bazelbuild-rules_python-68db9553946b6ad83e820e1297dddb9502601f8f.tar.gz |
fix: Ignore tempoary pyc.NNN files in wheels (#1266)
We ignore pyc files most everywhere (because they aren't deterministic),
but part of the pyc creation process involves creating temporary files
named `*.pyc.NNN`. Though these are supposed to be temporary files
nobody sees, they seem to get picked up by a glob somewhere, somehow.
I'm unable to figure out how that is happening, but ignoring them in the
glob expressions should also suffice.
Fixes #1261
-rw-r--r-- | python/pip_install/repositories.bzl | 1 | ||||
-rw-r--r-- | python/pip_install/tools/wheel_installer/wheel_installer.py | 1 | ||||
-rw-r--r-- | python/repositories.bzl | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/python/pip_install/repositories.bzl b/python/pip_install/repositories.bzl index 2dd4a37..efe3bc7 100644 --- a/python/pip_install/repositories.bzl +++ b/python/pip_install/repositories.bzl @@ -106,6 +106,7 @@ py_library( # to avoid non-determinism following pip install's behavior. "**/*.py", "**/*.pyc", + "**/*.pyc.*", # During pyc creation, temp files named *.pyc.NNN are created "**/* *", "**/*.dist-info/RECORD", "BUILD", diff --git a/python/pip_install/tools/wheel_installer/wheel_installer.py b/python/pip_install/tools/wheel_installer/wheel_installer.py index 5a6f49b..9b363c3 100644 --- a/python/pip_install/tools/wheel_installer/wheel_installer.py +++ b/python/pip_install/tools/wheel_installer/wheel_installer.py @@ -226,6 +226,7 @@ def _generate_build_file_contents( "**/* *", "**/*.py", "**/*.pyc", + "**/*.pyc.*", # During pyc creation, temp files named *.pyc.NNNN are created # RECORD is known to contain sha256 checksums of files which might include the checksums # of generated files produced when wheels are installed. The file is ignored to avoid # Bazel caching issues. diff --git a/python/repositories.bzl b/python/repositories.bzl index e841e28..2352e22 100644 --- a/python/repositories.bzl +++ b/python/repositories.bzl @@ -219,6 +219,7 @@ def _python_repository_impl(rctx): # the definition of this filegroup will change, and depending rules will get invalidated." # See https://github.com/bazelbuild/rules_python/issues/1008 for unconditionally adding these to toolchains so we can stop ignoring them." "**/__pycache__/*.pyc", + "**/__pycache__/*.pyc.*", # During pyc creation, temp files named *.pyc.NNN are created "**/__pycache__/*.pyo", ] |