Fix py_proto generation for submodules
Some checks are pending
/ setup (push) Waiting to run

This commit is contained in:
Stuart Axelbrooke 2025-08-06 17:04:39 -07:00
parent 501ea6c1cd
commit 1789357a08
3 changed files with 10 additions and 5 deletions

View file

@ -169,10 +169,15 @@ genrule(
"py_proto_out/message_pool.py", "py_proto_out/message_pool.py",
], ],
cmd = """ cmd = """
mkdir -p $(GENDIR)/databuild/py_proto_out mkdir -p $(@D)
export PATH=$$PATH:$$(dirname $(location :protoc-gen-python_betterproto2)) export PATH=$$PATH:$$(dirname $(location :protoc-gen-python_betterproto2))
export PATH=$$PATH:$$(dirname $(location //:ruff_binary)) export PATH=$$PATH:$$(dirname $(location //:ruff_binary))
$(location @com_google_protobuf//:protoc) --python_betterproto2_out=$(GENDIR)/databuild/py_proto_out $(location databuild.proto) $(location @com_google_protobuf//:protoc) --python_betterproto2_out=$(@D) $(location databuild.proto)
mkdir -p $(@D)/py_proto_out/databuild/v1
cp $(@D)/databuild/__init__.py $(@D)/py_proto_out/__init__.py
cp $(@D)/databuild/__init__.py $(@D)/py_proto_out/databuild/__init__.py
cp $(@D)/databuild/v1/__init__.py $(@D)/py_proto_out/databuild/v1/__init__.py
cp $(@D)/message_pool.py $(@D)/py_proto_out/message_pool.py
""", """,
tools = [ tools = [
":protoc-gen-python_betterproto2", ":protoc-gen-python_betterproto2",

View file

@ -14,13 +14,13 @@ bazel_dep(name = "rules_python", version = "1.3.0")
python = use_extension("@rules_python//python/extensions:python.bzl", "python") python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain( python.toolchain(
python_version = "3.13", python_version = "3.12",
) )
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse( pip.parse(
hub_name = "pypi", hub_name = "pypi",
python_version = "3.13", python_version = "3.12",
requirements_lock = "//:requirements_lock.txt", requirements_lock = "//:requirements_lock.txt",
) )
use_repo(pip, "pypi") use_repo(pip, "pypi")

View file

@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile with Python 3.13 # This file is autogenerated by pip-compile with Python 3.12
# by the following command: # by the following command:
# #
# bazel run //:py_requirements.update # bazel run //:py_requirements.update