1 # Copyright 2015 gRPC authors. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 # distutils: language=c++ 15 16 cimport cpython 17 18 import pkg_resources 19 import os.path 20 import sys 21 22 # TODO(atash): figure out why the coverage tool gets confused about the Cython 23 # coverage plugin when the following files don't have a '.pxi' suffix. 24 include "_cygrpc/grpc_string.pyx.pxi" 25 include "_cygrpc/arguments.pyx.pxi" 26 include "_cygrpc/call.pyx.pxi" 27 include "_cygrpc/channel.pyx.pxi" 28 include "_cygrpc/credentials.pyx.pxi" 29 include "_cygrpc/completion_queue.pyx.pxi" 30 include "_cygrpc/event.pyx.pxi" 31 include "_cygrpc/metadata.pyx.pxi" 32 include "_cygrpc/operation.pyx.pxi" 33 include "_cygrpc/records.pyx.pxi" 34 include "_cygrpc/security.pyx.pxi" 35 include "_cygrpc/server.pyx.pxi" 36 include "_cygrpc/tag.pyx.pxi" 37 include "_cygrpc/time.pyx.pxi" 38 include "_cygrpc/_hooks.pyx.pxi" 39 40 include "_cygrpc/grpc_gevent.pyx.pxi" 41 42 IF UNAME_SYSNAME == "Windows": 43 include "_cygrpc/fork_windows.pyx.pxi" 44 ELSE: 45 include "_cygrpc/fork_posix.pyx.pxi" 46 47 # 48 # initialize gRPC 49 # 50 cdef extern from "Python.h": 51 52 int PyEval_InitThreads() 53 54 cdef _initialize(): 55 # We have Python callbacks called by c-core threads, this ensures the GIL 56 # is initialized. 57 PyEval_InitThreads() 58 grpc_set_ssl_roots_override_callback( 59 <grpc_ssl_roots_override_callback>ssl_roots_override_callback) 60 61 62 _initialize() 63