aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Masood Malekghassemi <atash@google.com>2016-12-12 15:34:34 -0800
committerGravatar Masood Malekghassemi <atash@google.com>2016-12-12 16:24:25 -0800
commitf096f540eeb057103eb5c2330a4165e0aa251ff1 (patch)
tree1c1e2ce9b845f47002a3f3f60ba2cf2e96dda8f5
parent7ba3527ffe6900a3c68059eec2220a17f6bd819c (diff)
Recover 'namespace'd Python distribution packages
Uses dynamic loading to paper-over the negative effects of losing namespace packages in the previous commit.
-rw-r--r--src/python/grpcio/grpc/__init__.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py
index d4e3152c59..f801dd632a 100644
--- a/src/python/grpcio/grpc/__init__.py
+++ b/src/python/grpcio/grpc/__init__.py
@@ -31,6 +31,7 @@
import abc
import enum
+import sys
import six
@@ -1293,3 +1294,24 @@ __all__ = (
'secure_channel',
'server',
)
+
+
+############################### Extension Shims ################################
+
+
+# Here to maintain backwards compatibility; avoid using these in new code!
+try:
+ import grpc_tools
+ sys.modules.update({'grpc.tools': grpc_tools})
+except ImportError:
+ pass
+try:
+ import grpc_health
+ sys.modules.update({'grpc.health': grpc_health})
+except ImportError:
+ pass
+try:
+ import grpc_reflection
+ sys.modules.update({'grpc.reflection': grpc_reflection})
+except ImportError:
+ pass