aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python
diff options
context:
space:
mode:
authorGravatar Masood Malekghassemi <atash@google.com>2016-06-05 17:04:44 -0700
committerGravatar Masood Malekghassemi <atash@google.com>2016-07-08 12:36:15 -0700
commit639bb3996fa5b4f9d1785376c19ab69f747e0da8 (patch)
tree51b991523b794c0a5f594e0c946105fa2e8c95ed /src/python
parent06c857cb86586755ab5f01f1a8fecc614f23dffa (diff)
Build Python distributions standalone for Windows
Diffstat (limited to 'src/python')
-rw-r--r--src/python/grpcio/grpc/_cython/cygrpc.pyx7
-rw-r--r--src/python/grpcio/grpc/_cython/loader.c8
2 files changed, 6 insertions, 9 deletions
diff --git a/src/python/grpcio/grpc/_cython/cygrpc.pyx b/src/python/grpcio/grpc/_cython/cygrpc.pyx
index 7a8d0dd8a1..e055d321bc 100644
--- a/src/python/grpcio/grpc/_cython/cygrpc.pyx
+++ b/src/python/grpcio/grpc/_cython/cygrpc.pyx
@@ -50,13 +50,6 @@ include "grpc/_cython/_cygrpc/server.pyx.pxi"
def _initialize():
- if 'win32' in sys.platform:
- filename = pkg_resources.resource_filename(
- 'grpc._cython', '_windows/grpc_c.64.python')
- if not isinstance(filename, bytes):
- filename = filename.encode()
- if not pygrpc_load_core(filename):
- raise ImportError('failed to load core gRPC library')
if not pygrpc_initialize_core():
raise ImportError('failed to initialize core gRPC library')
diff --git a/src/python/grpcio/grpc/_cython/loader.c b/src/python/grpcio/grpc/_cython/loader.c
index 750a9f6fa3..34bd897549 100644
--- a/src/python/grpcio/grpc/_cython/loader.c
+++ b/src/python/grpcio/grpc/_cython/loader.c
@@ -38,10 +38,14 @@
extern "C" {
#endif /* __cpluslus */
-/* TODO(atash) remove cruft */
-
int pygrpc_load_core(char *path) { return 1; }
+// Cython doesn't have Py_AtExit bindings, so we call the C_API directly
+int pygrpc_initialize_core(void) {
+ grpc_init();
+ return Py_AtExit(grpc_shutdown) < 0 ? 0 : 1;
+}
+
#ifdef __cplusplus
}
#endif /* __cpluslus */