diff options
author | Lidi Zheng <scallopsky@gmail.com> | 2018-11-05 17:00:46 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-05 17:00:46 -0800 |
commit | 2a1fbccb2c046c907659d126f3ccbed0270d26d2 (patch) | |
tree | e5122ae557ce98f77b640f28bb63cfa1d85cf973 /src/python/grpcio | |
parent | 6b934a8361ae0908dc59626351355f615b87dd43 (diff) | |
parent | 187f7e4e4ce362bd8e6fb66e2fbf39021cc57aab (diff) |
Merge pull request #16976 from benjaminp/remove-pkg_resources
Replace pkg_resources with pkgutil.
Diffstat (limited to 'src/python/grpcio')
-rw-r--r-- | src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi | 8 | ||||
-rw-r--r-- | src/python/grpcio/grpc/_cython/cygrpc.pyx | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi index 7decae95bb..e17ca6d335 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi @@ -14,14 +14,16 @@ from libc.string cimport memcpy -import pkg_resources +import pkgutil cdef grpc_ssl_roots_override_result ssl_roots_override_callback( char **pem_root_certs) nogil: with gil: - temporary_pem_root_certs = pkg_resources.resource_string( - __name__.rstrip('.cygrpc'), '_credentials/roots.pem') + pkg = __name__ + if pkg.endswith('.cygrpc'): + pkg = pkg[:-len('.cygrpc')] + temporary_pem_root_certs = pkgutil.get_data(pkg, '_credentials/roots.pem') pem_root_certs[0] = <char *>gpr_malloc(len(temporary_pem_root_certs) + 1) memcpy( pem_root_certs[0], <char *>temporary_pem_root_certs, diff --git a/src/python/grpcio/grpc/_cython/cygrpc.pyx b/src/python/grpcio/grpc/_cython/cygrpc.pyx index 026f7ba2e3..ae5c07bfc8 100644 --- a/src/python/grpcio/grpc/_cython/cygrpc.pyx +++ b/src/python/grpcio/grpc/_cython/cygrpc.pyx @@ -15,7 +15,6 @@ cimport cpython -import pkg_resources import os.path import sys |