From d57aec1858c84eb7f778a5e186c3c30e7d700e34 Mon Sep 17 00:00:00 2001 From: UebelAndre Date: Mon, 15 Nov 2021 20:08:08 -0800 Subject: [PATCH] Ignore `__pycache__` contents and `*.pyc` files in external dependencies --- python/pip_install/extract_wheels/lib/bazel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/pip_install/extract_wheels/lib/bazel.py b/python/pip_install/extract_wheels/lib/bazel.py index 433a9ea54a..b17a1d4ef5 100644 --- a/python/pip_install/extract_wheels/lib/bazel.py +++ b/python/pip_install/extract_wheels/lib/bazel.py @@ -104,7 +104,9 @@ def generate_build_file_contents( data_exclude = [ "*.whl", + "**/__pycache__/**", "**/*.py", + "**/*.pyc", f"{WHEEL_ENTRY_POINT_PREFIX}*.py", "**/* *", "BUILD.bazel", @@ -135,7 +137,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.