Merge pull request #7188 from kpayson64/grpcio_tools_fix

Use open-source defaults to propagate Python plugin configuration
pull/7221/head
Nicolas Noble 9 years ago committed by GitHub
commit aab31a56f7
  1. 3
      src/compiler/python_generator.cc
  2. 1
      src/compiler/python_generator.h
  3. 2
      src/compiler/python_plugin.cc
  4. 1
      tools/distrib/python/grpcio_tools/grpc/tools/main.cc

@ -66,6 +66,9 @@ using std::vector;
namespace grpc_python_generator { namespace grpc_python_generator {
GeneratorConfiguration::GeneratorConfiguration()
: grpc_package_root("grpc"), beta_package_root("grpc.beta") {}
PythonGrpcGenerator::PythonGrpcGenerator(const GeneratorConfiguration& config) PythonGrpcGenerator::PythonGrpcGenerator(const GeneratorConfiguration& config)
: config_(config) {} : config_(config) {}

@ -43,6 +43,7 @@ namespace grpc_python_generator {
// Data pertaining to configuration of the generator with respect to anything // Data pertaining to configuration of the generator with respect to anything
// that may be used internally at Google. // that may be used internally at Google.
struct GeneratorConfiguration { struct GeneratorConfiguration {
GeneratorConfiguration();
grpc::string grpc_package_root; grpc::string grpc_package_root;
grpc::string beta_package_root; grpc::string beta_package_root;
}; };

@ -38,8 +38,6 @@
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
grpc_python_generator::GeneratorConfiguration config; grpc_python_generator::GeneratorConfiguration config;
config.grpc_package_root = "grpc";
config.beta_package_root = "grpc.beta";
grpc_python_generator::PythonGrpcGenerator generator(config); grpc_python_generator::PythonGrpcGenerator generator(config);
return grpc::protobuf::compiler::PluginMain(argc, argv, &generator); return grpc::protobuf::compiler::PluginMain(argc, argv, &generator);
} }

@ -45,7 +45,6 @@ int protoc_main(int argc, char* argv[]) {
// gRPC Python // gRPC Python
grpc_python_generator::GeneratorConfiguration grpc_py_config; grpc_python_generator::GeneratorConfiguration grpc_py_config;
grpc_py_config.beta_package_root = "grpc.beta";
grpc_python_generator::PythonGrpcGenerator grpc_py_generator(grpc_py_config); grpc_python_generator::PythonGrpcGenerator grpc_py_generator(grpc_py_config);
cli.RegisterGenerator("--grpc_python_out", &grpc_py_generator, cli.RegisterGenerator("--grpc_python_out", &grpc_py_generator,
"Generate Python source file."); "Generate Python source file.");

Loading…
Cancel
Save