Modernize cancellation example

pull/19822/head
Richard Belleville 5 years ago
parent e1980a7a5a
commit 66114201b4
  1. 24
      examples/python/cancellation/BUILD.bazel

@ -15,7 +15,7 @@
# limitations under the License. # limitations under the License.
load("@grpc_python_dependencies//:requirements.bzl", "requirement") 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) package(default_testonly = 1)
@ -25,9 +25,14 @@ proto_library(
) )
py_proto_library( py_proto_library(
name = "hash_name_proto_pb2", name = "hash_name_py_pb2",
deps = [":hash_name_proto"], srcs = [":hash_name_proto"],
well_known_protos = False, )
py_grpc_library(
name = "hash_name_py_pb2_grpc",
srcs = [":hash_name_proto"],
deps = [":hash_name_py_pb2"],
) )
py_binary( py_binary(
@ -35,8 +40,9 @@ py_binary(
srcs = ["client.py"], srcs = ["client.py"],
deps = [ deps = [
"//src/python/grpcio/grpc:grpcio", "//src/python/grpcio/grpc:grpcio",
":hash_name_proto_pb2", ":hash_name_py_pb2",
requirement("six"), ":hash_name_py_pb2_grpc",
"//external:six"
], ],
srcs_version = "PY2AND3", srcs_version = "PY2AND3",
) )
@ -46,7 +52,7 @@ py_library(
srcs = ["search.py"], srcs = ["search.py"],
srcs_version = "PY2AND3", srcs_version = "PY2AND3",
deps = [ deps = [
":hash_name_proto_pb2", ":hash_name_py_pb2",
], ],
) )
@ -55,10 +61,10 @@ py_binary(
srcs = ["server.py"], srcs = ["server.py"],
deps = [ deps = [
"//src/python/grpcio/grpc:grpcio", "//src/python/grpcio/grpc:grpcio",
":hash_name_proto_pb2", ":hash_name_py_pb2",
":search", ":search",
] + select({ ] + select({
"//conditions:default": [requirement("futures")], "//conditions:default": ["@futures//:futures"],
"//:python3": [], "//:python3": [],
}), }),
srcs_version = "PY2AND3", srcs_version = "PY2AND3",

Loading…
Cancel
Save