aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio_reflection/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/python/grpcio_reflection/setup.py')
-rw-r--r--src/python/grpcio_reflection/setup.py47
1 files changed, 36 insertions, 11 deletions
diff --git a/src/python/grpcio_reflection/setup.py b/src/python/grpcio_reflection/setup.py
index 9360550afb..760b89373a 100644
--- a/src/python/grpcio_reflection/setup.py
+++ b/src/python/grpcio_reflection/setup.py
@@ -21,10 +21,26 @@ import setuptools
# Ensure we're in the proper directory whether or not we're being used by pip.
os.chdir(os.path.dirname(os.path.abspath(__file__)))
-# Break import-style to ensure we can actually find our commands module.
-import reflection_commands
+# Break import-style to ensure we can actually find our local modules.
import grpc_version
+
+class _NoOpCommand(setuptools.Command):
+ """No-op command."""
+
+ description = ''
+ user_options = []
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ pass
+
+
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
@@ -41,17 +57,26 @@ PACKAGE_DIRECTORIES = {
'': '.',
}
-SETUP_REQUIRES = (
- 'grpcio-tools>={version}'.format(version=grpc_version.VERSION),)
-
-INSTALL_REQUIRES = ('protobuf>=3.3.0',
+INSTALL_REQUIRES = ('protobuf>=3.5.0.post1',
'grpcio>={version}'.format(version=grpc_version.VERSION),)
-COMMAND_CLASS = {
- # Run preprocess from the repository *before* doing any packaging!
- 'preprocess': reflection_commands.CopyProtoModules,
- 'build_package_protos': reflection_commands.BuildPackageProtos,
-}
+try:
+ import reflection_commands as _reflection_commands
+ # we are in the build environment, otherwise the above import fails
+ SETUP_REQUIRES = (
+ 'grpcio-tools=={version}'.format(version=grpc_version.VERSION),)
+ COMMAND_CLASS = {
+ # Run preprocess from the repository *before* doing any packaging!
+ 'preprocess': _reflection_commands.CopyProtoModules,
+ 'build_package_protos': _reflection_commands.BuildPackageProtos,
+ }
+except ImportError:
+ SETUP_REQUIRES = ()
+ COMMAND_CLASS = {
+ # wire up commands to no-op not to break the external dependencies
+ 'preprocess': _NoOpCommand,
+ 'build_package_protos': _NoOpCommand,
+ }
setuptools.setup(
name='grpcio-reflection',