aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio/grpc/__init__.py
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:23:33 -0800
commit53f6d098a7d79325005be594b17096ee0a82ae26 (patch)
treeb21d64b1c03d7cafeeddc6a3b7fca1b7acbf7191 /src/python/grpcio/grpc/__init__.py
parentfb261bf74803eace0b733cac934b1a4632f3cbfd (diff)
Recover 'namespace'd Python distribution packages
Uses dynamic loading to paper-over the negative effects of losing namespace packages in the previous commit.
Diffstat (limited to 'src/python/grpcio/grpc/__init__.py')
-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 cfad7de42f..3713c1fd44 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
@@ -1342,3 +1343,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