aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio_testing/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/python/grpcio_testing/setup.py')
-rw-r--r--src/python/grpcio_testing/setup.py33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/python/grpcio_testing/setup.py b/src/python/grpcio_testing/setup.py
index 6ceb1fc5c9..18db71e0f0 100644
--- a/src/python/grpcio_testing/setup.py
+++ b/src/python/grpcio_testing/setup.py
@@ -24,6 +24,23 @@ os.chdir(os.path.dirname(os.path.abspath(__file__)))
# Break import style to ensure that we can find same-directory 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
+
+
PACKAGE_DIRECTORIES = {
'': '.',
}
@@ -33,6 +50,19 @@ INSTALL_REQUIRES = (
'grpcio>={version}'.format(version=grpc_version.VERSION),
)
+try:
+ import testing_commands as _testing_commands
+ # we are in the build environment, otherwise the above import fails
+ COMMAND_CLASS = {
+ # Run preprocess from the repository *before* doing any packaging!
+ 'preprocess': _testing_commands.Preprocess,
+ }
+except ImportError:
+ COMMAND_CLASS = {
+ # wire up commands to no-op not to break the external dependencies
+ 'preprocess': _NoOpCommand,
+ }
+
setuptools.setup(
name='grpcio-testing',
version=grpc_version.VERSION,
@@ -43,4 +73,5 @@ setuptools.setup(
url='https://grpc.io',
package_dir=PACKAGE_DIRECTORIES,
packages=setuptools.find_packages('.'),
- install_requires=INSTALL_REQUIRES)
+ install_requires=INSTALL_REQUIRES,
+ cmdclass=COMMAND_CLASS)