diff options
author | Benjamin Peterson <benjamin@dropbox.com> | 2018-10-23 09:16:13 -0700 |
---|---|---|
committer | Benjamin Peterson <benjamin@dropbox.com> | 2018-11-01 17:01:12 -0700 |
commit | 187f7e4e4ce362bd8e6fb66e2fbf39021cc57aab (patch) | |
tree | 2c75be376c2ab06f4a7b0ce674b64369c5bf2748 /src/python/grpcio/grpc | |
parent | f091ba1b66f356abf6c89507e98940f448269215 (diff) |
Replace pkg_resources with pkgutil.
pkg_resources (part of setuptools) is overkill for reading resource files. The standard library module pkgutil can do that just fine.
Diffstat (limited to 'src/python/grpcio/grpc')
-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 |