diff options
author | Craig Tiller <ctiller@google.com> | 2017-03-09 15:09:34 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-03-09 15:09:34 -0800 |
commit | af1158126075c007a0e2fcdf99609545685f62e6 (patch) | |
tree | 1e50761cd5a2414789cb51dc048c6fbd44c91682 /tools/distrib/python/grpcio_tools/setup.py | |
parent | 4d92a49fc0a96afc7f4539c0e600f06b6e4089f6 (diff) | |
parent | eb064ec7b81b60c5e1eb47d6124d0c05056b3097 (diff) |
Merge github.com:grpc/grpc into cpp_bazelness
Diffstat (limited to 'tools/distrib/python/grpcio_tools/setup.py')
-rw-r--r-- | tools/distrib/python/grpcio_tools/setup.py | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/tools/distrib/python/grpcio_tools/setup.py b/tools/distrib/python/grpcio_tools/setup.py index 502d7ef27b..ed27f1f835 100644 --- a/tools/distrib/python/grpcio_tools/setup.py +++ b/tools/distrib/python/grpcio_tools/setup.py @@ -157,11 +157,28 @@ def extension_modules(): plugin_sources = [os.path.join('grpc_tools', '_protoc_compiler.pyx')] else: plugin_sources = [os.path.join('grpc_tools', '_protoc_compiler.cpp')] + plugin_sources += [ os.path.join('grpc_tools', 'main.cc'), - os.path.join('grpc_root', 'src', 'compiler', 'python_generator.cc')] + [ - os.path.join(CC_INCLUDE, cc_file) - for cc_file in CC_FILES] + os.path.join('grpc_root', 'src', 'compiler', 'python_generator.cc')] + + #HACK: Substitute the embed.cc, which is a JS to C++ + # preprocessor with the generated code. + # The generated code should not be material + # to the parts of protoc we use (it affects + # the JavaScript code generator, supposedly), + # but we need to be cautious about it. + cc_files_clone = list(CC_FILES) + embed_cc_file = os.path.normpath('google/protobuf/compiler/js/embed.cc') + well_known_types_file = os.path.normpath( + 'google/protobuf/compiler/js/well_known_types_embed.cc') + if embed_cc_file in cc_files_clone: + cc_files_clone.remove(embed_cc_file) + if well_known_types_file in cc_files_clone: + cc_files_clone.remove(well_known_types_file) + plugin_sources += [os.path.join('grpc_tools', 'protobuf_generated_well_known_types_embed.cc')] + plugin_sources += [os.path.join(CC_INCLUDE, cc_file) for cc_file in cc_files_clone] + plugin_ext = extension.Extension( name='grpc_tools._protoc_compiler', sources=plugin_sources, @@ -190,7 +207,7 @@ setuptools.setup( ext_modules=extension_modules(), packages=setuptools.find_packages('.'), install_requires=[ - 'protobuf>=3.0.0', + 'protobuf>=3.2.0', 'grpcio>={version}'.format(version=grpc_version.VERSION), ], package_data=package_data(), |