diff options
Diffstat (limited to 'src/python/grpcio')
-rw-r--r-- | src/python/grpcio/README.rst | 2 | ||||
-rw-r--r-- | src/python/grpcio/commands.py | 26 | ||||
-rw-r--r-- | src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi | 2 | ||||
-rw-r--r-- | src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi | 5 | ||||
-rw-r--r-- | src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi | 11 | ||||
-rw-r--r-- | src/python/grpcio/grpc_core_dependencies.py | 3 |
6 files changed, 31 insertions, 18 deletions
diff --git a/src/python/grpcio/README.rst b/src/python/grpcio/README.rst index 3fc318539e..28a2714568 100644 --- a/src/python/grpcio/README.rst +++ b/src/python/grpcio/README.rst @@ -6,7 +6,7 @@ Package for gRPC Python. Installation ------------ -gRPC Python is available for Linux, Mac OS X, and Windows running Python 2.7. +gRPC Python is available for Linux, macOS, and Windows. From PyPI ~~~~~~~~~ diff --git a/src/python/grpcio/commands.py b/src/python/grpcio/commands.py index e50ccbe23e..4f072809c4 100644 --- a/src/python/grpcio/commands.py +++ b/src/python/grpcio/commands.py @@ -260,12 +260,36 @@ class BuildExt(build_ext.build_ext): """Custom build_ext command to enable compiler-specific flags.""" C_OPTIONS = { - 'unix': ('-pthread', '-std=gnu99'), + 'unix': ('-pthread',), 'msvc': (), } LINK_OPTIONS = {} def build_extensions(self): + if "darwin" in sys.platform: + config = os.environ.get('CONFIG', 'opt') + target_path = os.path.abspath( + os.path.join( + os.path.dirname(os.path.realpath(__file__)), '..', '..', + '..', 'libs', config)) + targets = [ + os.path.join(target_path, 'libboringssl.a'), + os.path.join(target_path, 'libares.a'), + os.path.join(target_path, 'libgpr.a'), + os.path.join(target_path, 'libgrpc.a') + ] + make_process = subprocess.Popen( + ['make'] + targets, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + make_out, make_err = make_process.communicate() + if make_out and make_process.returncode != 0: + sys.stdout.write(make_out + '\n') + if make_err: + sys.stderr.write(make_err + '\n') + if make_process.returncode != 0: + raise Exception("make command failed!") + compiler = self.compiler.compiler_type if compiler in BuildExt.C_OPTIONS: for extension in self.extensions: diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi index cc3bd7a067..aa3558b843 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi @@ -106,7 +106,7 @@ cdef class Call: def __dealloc__(self): if self.c_call != NULL: - grpc_call_destroy(self.c_call) + grpc_call_unref(self.c_call) grpc_shutdown() # The object *should* always be valid from Python. Used for debugging. diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi index 0b2bdef48b..f66f6e4122 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi @@ -329,7 +329,7 @@ cdef extern from "grpc/grpc.h": const char *description, void *reserved) nogil char *grpc_call_get_peer(grpc_call *call) nogil - void grpc_call_destroy(grpc_call *call) nogil + void grpc_call_unref(grpc_call *call) nogil grpc_channel *grpc_insecure_channel_create(const char *target, const grpc_channel_args *args, @@ -356,8 +356,6 @@ cdef extern from "grpc/grpc.h": void grpc_server_register_completion_queue(grpc_server *server, grpc_completion_queue *cq, void *reserved) nogil - void grpc_server_register_non_listening_completion_queue( - grpc_server *server, grpc_completion_queue *cq, void *reserved) nogil int grpc_server_add_insecure_http2_port( grpc_server *server, const char *addr) nogil void grpc_server_start(grpc_server *server) nogil @@ -502,4 +500,3 @@ cdef extern from "grpc/compression.h": int grpc_compression_options_is_algorithm_enabled( const grpc_compression_options *opts, grpc_compression_algorithm algorithm) nogil - diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi index 18db38b686..97192efda7 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi @@ -82,20 +82,11 @@ cdef class Server: self.c_server, queue.c_completion_queue, NULL) self.registered_completion_queues.append(queue) - def register_non_listening_completion_queue( - self, CompletionQueue queue not None): - if self.is_started: - raise ValueError("cannot register completion queues after start") - with nogil: - grpc_server_register_non_listening_completion_queue( - self.c_server, queue.c_completion_queue, NULL) - self.registered_completion_queues.append(queue) - def start(self): if self.is_started: raise ValueError("the server has already started") self.backup_shutdown_queue = CompletionQueue() - self.register_non_listening_completion_queue(self.backup_shutdown_queue) + self.register_completion_queue(self.backup_shutdown_queue) self.is_started = True with nogil: grpc_server_start(self.c_server) diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 16bb32bcc6..d2a570cc87 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -179,7 +179,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/surface/completion_queue.c', 'src/core/lib/surface/completion_queue_factory.c', 'src/core/lib/surface/event_string.c', - 'src/core/lib/surface/lame_client.c', + 'src/core/lib/surface/lame_client.cc', 'src/core/lib/surface/metadata_array.c', 'src/core/lib/surface/server.c', 'src/core/lib/surface/validate_metadata.c', @@ -251,6 +251,7 @@ CORE_SOURCE_FILES = [ 'src/core/tsi/fake_transport_security.c', 'src/core/tsi/ssl_transport_security.c', 'src/core/tsi/transport_security.c', + 'src/core/tsi/transport_security_adapter.c', 'src/core/ext/transport/chttp2/server/chttp2_server.c', 'src/core/ext/transport/chttp2/client/secure/secure_channel_create.c', 'src/core/ext/filters/client_channel/channel_connectivity.c', |