Fix the entry condition of Bazel hack

pull/19539/head
Lidi Zheng 6 years ago
parent b389c00f64
commit dbec6006a6
  1. 5
      src/python/grpcio_tests/tests/bazel_namespace_package_hack.py
  2. 1
      tools/bazel.rc

@ -16,6 +16,8 @@ import os
import site
import sys
_GRPC_BAZEL_RUNTIME_ENV = "GRPC_BAZEL_RUNTIME"
# TODO(https://github.com/bazelbuild/bazel/issues/6844) Bazel failed to
# interpret namespace packages correctly. This monkey patch will force the
@ -24,6 +26,9 @@ import sys
# Analysis in depth: https://github.com/bazelbuild/rules_python/issues/55
def sys_path_to_site_dir_hack():
"""Add valid sys.path item to site directory to parse the .pth files."""
# Only run within our Bazel environment
if not os.environ.get(_GRPC_BAZEL_RUNTIME_ENV):
return
items = []
for item in sys.path:
if os.path.exists(item):

@ -5,6 +5,7 @@
build --client_env=CC=clang
build --copt=-DGRPC_BAZEL_BUILD
build --action_env=GRPC_BAZEL_RUNTIME=1
build:opt --compilation_mode=opt
build:opt --copt=-Wframe-larger-than=16384

Loading…
Cancel
Save