xref: /aosp_15_r20/external/grpc-grpc/src/python/grpcio/grpc/_cython/cygrpc.pyx (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
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
16cimport cpython
17
18import logging
19import os
20import sys
21import threading
22import time
23
24import grpc
25
26try:
27    import asyncio
28except ImportError:
29    # TODO(https://github.com/grpc/grpc/issues/19728) Improve how Aio Cython is
30    # distributed without breaking none compatible Python versions. For now, if
31    # Asyncio package is not available we just skip it.
32    pass
33
34# The only copy of Python logger for the Cython extension
35_LOGGER = logging.getLogger(__name__)
36
37# TODO(atash): figure out why the coverage tool gets confused about the Cython
38# coverage plugin when the following files don't have a '.pxi' suffix.
39include "_cygrpc/grpc_string.pyx.pxi"
40include "_cygrpc/arguments.pyx.pxi"
41include "_cygrpc/call.pyx.pxi"
42include "_cygrpc/channel.pyx.pxi"
43include "_cygrpc/channelz.pyx.pxi"
44include "_cygrpc/csds.pyx.pxi"
45include "_cygrpc/credentials.pyx.pxi"
46include "_cygrpc/completion_queue.pyx.pxi"
47include "_cygrpc/event.pyx.pxi"
48include "_cygrpc/metadata.pyx.pxi"
49include "_cygrpc/operation.pyx.pxi"
50include "_cygrpc/propagation_bits.pyx.pxi"
51include "_cygrpc/records.pyx.pxi"
52include "_cygrpc/security.pyx.pxi"
53include "_cygrpc/server.pyx.pxi"
54include "_cygrpc/tag.pyx.pxi"
55include "_cygrpc/time.pyx.pxi"
56include "_cygrpc/vtable.pyx.pxi"
57include "_cygrpc/_hooks.pyx.pxi"
58include "_cygrpc/observability.pyx.pxi"
59
60include "_cygrpc/grpc_gevent.pyx.pxi"
61
62include "_cygrpc/thread.pyx.pxi"
63
64IF UNAME_SYSNAME == "Windows":
65    include "_cygrpc/fork_windows.pyx.pxi"
66ELSE:
67    include "_cygrpc/fork_posix.pyx.pxi"
68
69# Following pxi files are part of the Aio module
70include "_cygrpc/aio/common.pyx.pxi"
71include "_cygrpc/aio/rpc_status.pyx.pxi"
72include "_cygrpc/aio/completion_queue.pyx.pxi"
73include "_cygrpc/aio/callback_common.pyx.pxi"
74include "_cygrpc/aio/grpc_aio.pyx.pxi"
75include "_cygrpc/aio/call.pyx.pxi"
76include "_cygrpc/aio/channel.pyx.pxi"
77include "_cygrpc/aio/server.pyx.pxi"
78
79
80#
81# initialize gRPC
82#
83cdef _initialize():
84  grpc_set_ssl_roots_override_callback(
85          <grpc_ssl_roots_override_callback>ssl_roots_override_callback)
86
87
88_initialize()
89