From 66114201b45f805278c632906c7bc0366482b07f Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Fri, 2 Aug 2019 15:11:06 -0700 Subject: [PATCH] Modernize cancellation example --- examples/python/cancellation/BUILD.bazel | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/examples/python/cancellation/BUILD.bazel b/examples/python/cancellation/BUILD.bazel index 81cd3a881b8..41b394a07a2 100644 --- a/examples/python/cancellation/BUILD.bazel +++ b/examples/python/cancellation/BUILD.bazel @@ -15,7 +15,7 @@ # limitations under the License. load("@grpc_python_dependencies//:requirements.bzl", "requirement") -load("//bazel:python_rules.bzl", "py_proto_library") +load("//bazel:python_rules.bzl", "py_proto_library", "py_grpc_library") package(default_testonly = 1) @@ -25,9 +25,14 @@ proto_library( ) py_proto_library( - name = "hash_name_proto_pb2", - deps = [":hash_name_proto"], - well_known_protos = False, + name = "hash_name_py_pb2", + srcs = [":hash_name_proto"], +) + +py_grpc_library( + name = "hash_name_py_pb2_grpc", + srcs = [":hash_name_proto"], + deps = [":hash_name_py_pb2"], ) py_binary( @@ -35,8 +40,9 @@ py_binary( srcs = ["client.py"], deps = [ "//src/python/grpcio/grpc:grpcio", - ":hash_name_proto_pb2", - requirement("six"), + ":hash_name_py_pb2", + ":hash_name_py_pb2_grpc", + "//external:six" ], srcs_version = "PY2AND3", ) @@ -46,7 +52,7 @@ py_library( srcs = ["search.py"], srcs_version = "PY2AND3", deps = [ - ":hash_name_proto_pb2", + ":hash_name_py_pb2", ], ) @@ -55,10 +61,10 @@ py_binary( srcs = ["server.py"], deps = [ "//src/python/grpcio/grpc:grpcio", - ":hash_name_proto_pb2", + ":hash_name_py_pb2", ":search", ] + select({ - "//conditions:default": [requirement("futures")], + "//conditions:default": ["@futures//:futures"], "//:python3": [], }), srcs_version = "PY2AND3",