blob: e055d321bc76fe99fcb354889b7ec49c7b264463 [file] [log] [blame]
Craig Tiller6169d5f2016-03-31 07:46:18 -07001# Copyright 2015, Google Inc.
Masood Malekghassemi743c10c2015-06-16 18:05:27 -07002# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met:
7#
8# * Redistributions of source code must retain the above copyright
9# notice, this list of conditions and the following disclaimer.
10# * Redistributions in binary form must reproduce the above
11# copyright notice, this list of conditions and the following disclaimer
12# in the documentation and/or other materials provided with the
13# distribution.
14# * Neither the name of Google Inc. nor the names of its
15# contributors may be used to endorse or promote products derived from
16# this software without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30cimport cpython
31
Masood Malekghassemidf1e07e2016-02-02 14:17:14 -080032import pkg_resources
33import os.path
Masood Malekghassemiae109e92016-02-04 13:46:58 -080034import sys
Masood Malekghassemidf1e07e2016-02-02 14:17:14 -080035
Masood Malekghassemi116982e2015-12-11 15:53:38 -080036# TODO(atash): figure out why the coverage tool gets confused about the Cython
37# coverage plugin when the following files don't have a '.pxi' suffix.
Ken Payson1efb6012016-06-08 13:06:44 -070038include "grpc/_cython/_cygrpc/grpc_string.pyx.pxi"
Masood Malekghassemi116982e2015-12-11 15:53:38 -080039include "grpc/_cython/_cygrpc/call.pyx.pxi"
40include "grpc/_cython/_cygrpc/channel.pyx.pxi"
41include "grpc/_cython/_cygrpc/credentials.pyx.pxi"
42include "grpc/_cython/_cygrpc/completion_queue.pyx.pxi"
43include "grpc/_cython/_cygrpc/records.pyx.pxi"
Nathaniel Manistafa6cad72016-02-05 21:26:54 +000044include "grpc/_cython/_cygrpc/security.pyx.pxi"
Masood Malekghassemi116982e2015-12-11 15:53:38 -080045include "grpc/_cython/_cygrpc/server.pyx.pxi"
Masood Malekghassemi743c10c2015-06-16 18:05:27 -070046
47#
Ken Paysonf4c1bff2016-06-12 15:23:36 -070048# initialize gRPC
Masood Malekghassemi743c10c2015-06-16 18:05:27 -070049#
50
Masood Malekghassemi743c10c2015-06-16 18:05:27 -070051
Ken Paysonf4c1bff2016-06-12 15:23:36 -070052def _initialize():
Ken Paysonf4c1bff2016-06-12 15:23:36 -070053 if not pygrpc_initialize_core():
54 raise ImportError('failed to initialize core gRPC library')
Masood Malekghassemi10509a22016-02-03 13:32:22 -080055
Ken Paysonf4c1bff2016-06-12 15:23:36 -070056 grpc_set_ssl_roots_override_callback(
Masood Malekghassemi3d2d5b92016-03-15 15:54:25 -070057 <grpc_ssl_roots_override_callback>ssl_roots_override_callback)
Masood Malekghassemi743c10c2015-06-16 18:05:27 -070058
Ken Paysonf4c1bff2016-06-12 15:23:36 -070059_initialize()