Merge pull request #18641 from grpc/python_bazel_mitigation

Mitigate Python Bazel Breakage
pull/18643/head
Jan Tattermusch 6 years ago committed by GitHub
commit db14f3da4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 40
      WORKSPACE
  2. 16
      bazel/grpc_python_deps.bzl

@ -17,20 +17,13 @@ register_toolchains(
"//third_party/toolchains:cc-toolchain-clang-x86_64-default", "//third_party/toolchains:cc-toolchain-clang-x86_64-default",
) )
http_archive( # TODO(https://github.com/grpc/grpc/issues/18331): Move off of this dependency.
name = "cython", git_repository(
build_file = "//third_party:cython.BUILD", name = "org_pubref_rules_protobuf",
sha256 = "d68138a2381afbdd0876c3cb2a22389043fa01c4badede1228ee073032b07a27", remote = "https://github.com/ghostwriternr/rules_protobuf",
strip_prefix = "cython-c2b80d87658a8525ce091cbe146cb7eaa29fed5c", tag = "v0.8.2.1-alpha",
urls = [
"https://github.com/cython/cython/archive/c2b80d87658a8525ce091cbe146cb7eaa29fed5c.tar.gz",
],
) )
load("//third_party/py:python_configure.bzl", "python_configure")
python_configure(name = "local_config_python")
git_repository( git_repository(
name = "io_bazel_rules_python", name = "io_bazel_rules_python",
commit = "8b5d0683a7d878b28fffe464779c8a53659fc645", commit = "8b5d0683a7d878b28fffe464779c8a53659fc645",
@ -39,24 +32,21 @@ git_repository(
load("@io_bazel_rules_python//python:pip.bzl", "pip_repositories", "pip_import") load("@io_bazel_rules_python//python:pip.bzl", "pip_repositories", "pip_import")
pip_repositories()
pip_import( pip_import(
name = "grpc_python_dependencies", name = "grpc_python_dependencies",
requirements = "//:requirements.bazel.txt", requirements = "//:requirements.bazel.txt",
) )
load("@grpc_python_dependencies//:requirements.bzl", "pip_install") http_archive(
name = "cython",
pip_install() build_file = "//third_party:cython.BUILD",
sha256 = "d68138a2381afbdd0876c3cb2a22389043fa01c4badede1228ee073032b07a27",
# NOTE(https://github.com/pubref/rules_protobuf/pull/196): Switch to upstream repo after this gets merged. strip_prefix = "cython-c2b80d87658a8525ce091cbe146cb7eaa29fed5c",
git_repository( urls = [
name = "org_pubref_rules_protobuf", "https://github.com/cython/cython/archive/c2b80d87658a8525ce091cbe146cb7eaa29fed5c.tar.gz",
remote = "https://github.com/ghostwriternr/rules_protobuf", ],
tag = "v0.8.2.1-alpha",
) )
load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_repositories") load("//bazel:grpc_python_deps.bzl", "grpc_python_deps")
py_proto_repositories() grpc_python_deps()

@ -0,0 +1,16 @@
load("//third_party/py:python_configure.bzl", "python_configure")
load("@io_bazel_rules_python//python:pip.bzl", "pip_repositories")
load("@grpc_python_dependencies//:requirements.bzl", "pip_install")
load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_repositories")
def grpc_python_deps():
# TODO(https://github.com/grpc/grpc/issues/18256): Remove conditional.
if hasattr(native, "http_archive"):
python_configure(name = "local_config_python")
pip_repositories()
pip_install()
py_proto_repositories()
else:
print("Building Python gRPC with bazel 23.0+ is disabled pending " +
"resolution of https://github.com/grpc/grpc/issues/18256.")
Loading…
Cancel
Save