Skip to content

Commit c9f15ae

Browse files
authored
feat: re-enable Python example of using pre-built protoc (#42)
* feat: re-enable Python example of using pre-built protoc * chore: load py_test so it gets starlark PyInfo
1 parent 35b6b11 commit c9f15ae

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

examples/BUILD.bazel

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load("@rules_go//proto:def.bzl", "go_proto_library")
22
load("@rules_proto//proto:defs.bzl", "proto_library")
3+
load("@rules_python//python:proto.bzl", "py_proto_library")
34

45
package(default_visibility = ["//visibility:public"])
56

@@ -9,13 +10,10 @@ proto_library(
910
deps = ["@com_google_protobuf//:any_proto"],
1011
)
1112

12-
# Broken because rules_python's py_proto_library doesnt produce the same
13-
# PyInfo symbol that py_test expects.
14-
# load("@rules_python//python:proto.bzl", "py_proto_library")
15-
# py_proto_library(
16-
# name = "foo_py_proto",
17-
# deps = [":foo_proto"],
18-
# )
13+
py_proto_library(
14+
name = "foo_py_proto",
15+
deps = [":foo_proto"],
16+
)
1917

2018
# Broken by https://github.com/protocolbuffers/protobuf/pull/19679
2119
# which causes building C++ code from source.

examples/python/BUILD

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# See comment in examples/BUILD.bazel
2-
# py_test(
3-
# name = "message_test",
4-
# srcs = ["message_test.py"],
5-
# deps = ["//:foo_py_proto"],
6-
# )
1+
load("@rules_python//python:defs.bzl", "py_test")
2+
3+
py_test(
4+
name = "message_test",
5+
srcs = ["message_test.py"],
6+
deps = ["//:foo_py_proto"],
7+
)

0 commit comments

Comments
 (0)