From e194ecccf7fcfb3e026bc353b82671105b4b0b8e Mon Sep 17 00:00:00 2001
From: Reid 'arrdem' McKenzie <me@arrdem.com>
Date: Thu, 19 Aug 2021 23:29:06 -0600
Subject: [PATCH] Ignore .pyc object files

---
 tools/python/defs.bzl | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/tools/python/defs.bzl b/tools/python/defs.bzl
index ba5e155..ca586b8 100644
--- a/tools/python/defs.bzl
+++ b/tools/python/defs.bzl
@@ -163,14 +163,26 @@ def py_project(name=None,
 
     """
 
-    lib_srcs = lib_srcs or native.glob(["src/python/**/*.py"])
+    lib_srcs = lib_srcs or native.glob(["src/python/**/*.py"],
+                                       exclude=[
+                                           "**/*.pyc",
+                                       ])
     lib_data = lib_data or native.glob(["src/resources/**/*",
                                         "src/python/**/*"],
-                                       exclude=["**/*.py"])
-    test_srcs = test_srcs or native.glob(["test/python/**/*.py"])
+                                       exclude=[
+                                           "**/*.py",
+                                           "**/*.pyc",
+                                       ])
+    test_srcs = test_srcs or native.glob(["test/python/**/*.py"],
+                                         exclude=[
+                                             "**/*.pyc",
+                                         ])
     test_data = test_data or native.glob(["test/resources/**/*",
                                           "test/python/**/*"],
-                                         exclude=["**/*.py"])
+                                         exclude=[
+                                             "**/*.py",
+                                             "**/*.pyc",
+                                         ])
 
     py_library(
         name=name,