From 657b0fe820204bf89e94e26cc3a2322fbf859500 Mon Sep 17 00:00:00 2001 From: Reid 'arrdem' McKenzie Date: Sat, 3 Jun 2023 01:34:57 -0600 Subject: [PATCH] Make data and srcs additive --- tools/python/defs.bzl | 49 +++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/tools/python/defs.bzl b/tools/python/defs.bzl index abaac17..4e750bd 100644 --- a/tools/python/defs.bzl +++ b/tools/python/defs.bzl @@ -160,6 +160,7 @@ def py_project(name=None, main_deps=None, main_data=None, shebang=None, + zip_safe=True, lib_srcs=None, lib_deps=None, lib_data=None, @@ -177,26 +178,33 @@ def py_project(name=None, """ - 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", - "**/*.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", - "**/*.pyc", - ]) + 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", + "**/*.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", + "**/*.pyc", + ]) lib_name = name if not main else "lib" @@ -242,6 +250,7 @@ def py_project(name=None, "//visibility:public", ], shebang = shebang, + zip_safe=zip_safe, ) for src in test_srcs: