aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio_tests/commands.py
diff options
context:
space:
mode:
authorGravatar Nathaniel Manista <nathaniel@google.com>2017-09-13 20:05:34 +0000
committerGravatar Nathaniel Manista <nathaniel@google.com>2017-09-13 20:11:30 +0000
commit09a02ec04038e9eb45aae249d65bdf66f305d9d4 (patch)
treebcb50b9ab771dfea5178866ae932a4592f0cb2bd /src/python/grpcio_tests/commands.py
parent3bf7b714a5458aadfc1e2761ede1213f69ef7959 (diff)
Kill (grpcio_tests/)commands.BuildProtoModules
In 1ff429da2a94bc79300ebce3f8aae7efb10e9a75 it appears to have been copied out of src/python/grpcio/commands.py and not used, and it seems to have remained without use since.
Diffstat (limited to 'src/python/grpcio_tests/commands.py')
-rw-r--r--src/python/grpcio_tests/commands.py49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/python/grpcio_tests/commands.py b/src/python/grpcio_tests/commands.py
index 162200112a..93f84572b7 100644
--- a/src/python/grpcio_tests/commands.py
+++ b/src/python/grpcio_tests/commands.py
@@ -67,55 +67,6 @@ class GatherProto(setuptools.Command):
open(path, 'a').close()
-class BuildProtoModules(setuptools.Command):
- """Command to generate project *_pb2.py modules from proto files."""
-
- description = 'build protobuf modules'
- user_options = [
- ('include=', None, 'path patterns to include in protobuf generation'),
- ('exclude=', None, 'path patterns to exclude from protobuf generation')
- ]
-
- def initialize_options(self):
- self.exclude = None
- self.include = r'.*\.proto$'
-
- def finalize_options(self):
- pass
-
- def run(self):
- import grpc_tools.protoc as protoc
-
- include_regex = re.compile(self.include)
- exclude_regex = re.compile(self.exclude) if self.exclude else None
- paths = []
- for walk_root, directories, filenames in os.walk(PROTO_STEM):
- for filename in filenames:
- path = os.path.join(walk_root, filename)
- if include_regex.match(path) and not (
- exclude_regex and exclude_regex.match(path)):
- paths.append(path)
-
- # TODO(kpayson): It would be nice to do this in a batch command,
- # but we currently have name conflicts in src/proto
- for path in paths:
- command = [
- 'grpc_tools.protoc',
- '-I {}'.format(PROTO_STEM),
- '--python_out={}'.format(PROTO_STEM),
- '--grpc_python_out={}'.format(PROTO_STEM),
- ] + [path]
- if protoc.main(command) != 0:
- sys.stderr.write(
- 'warning: Command:\n{}\nFailed'.format(command))
-
- # Generated proto directories dont include __init__.py, but
- # these are needed for python package resolution
- for walk_root, _, _ in os.walk(PROTO_STEM):
- path = os.path.join(walk_root, '__init__.py')
- open(path, 'a').close()
-
-
class BuildPy(build_py.build_py):
"""Custom project build command."""