diff --git a/python/pip_install/extract_wheels/lib/bazel.py b/python/pip_install/extract_wheels/lib/bazel.py index 1ea4a7b77a..e07a193053 100644 --- a/python/pip_install/extract_wheels/lib/bazel.py +++ b/python/pip_install/extract_wheels/lib/bazel.py @@ -103,7 +103,9 @@ def generate_build_file_contents( data_exclude = [ "*.whl", + "**/__pycache__/**", "**/*.py", + "**/*.pyc", f"{WHEEL_ENTRY_POINT_PREFIX}*.py", "**/* *", "BUILD.bazel", @@ -134,7 +136,7 @@ def generate_build_file_contents( py_library( name = "{name}", - srcs = glob(["**/*.py"], exclude=["{entry_point_prefix}*.py"], allow_empty = True), + srcs = glob(["**/*.py"], exclude=["{entry_point_prefix}*.py", "**/__pycache__/**"], allow_empty = True), data = glob(["**/*"], exclude={data_exclude}), # This makes this directory a top-level in the python import # search path for anything that depends on this.