aboutsummaryrefslogtreecommitdiffhomepage
path: root/setup.py
diff options
context:
space:
mode:
authorGravatar Masood Malekghassemi <atash@google.com>2016-12-14 18:23:25 -0800
committerGravatar Masood Malekghassemi <atash@google.com>2016-12-14 18:23:25 -0800
commit5e43db8d8f1036904ca1343f4499a20f7188e7c4 (patch)
treedd328ff1e3e25f4266cb4fbcc6580ae2dc24a8bf /setup.py
parent9addf903de165bdab8a4b41f4678b4196a2257f2 (diff)
Fix Python setup-time diagnostic
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/setup.py b/setup.py
index 559a75f674..ab217433a3 100644
--- a/setup.py
+++ b/setup.py
@@ -218,15 +218,18 @@ SETUP_REQUIRES = INSTALL_REQUIRES + (
'six>=1.10',
) if ENABLE_DOCUMENTATION_BUILD else ()
-if BUILD_WITH_CYTHON:
- sys.stderr.write(
- "You requested a Cython build via GRPC_PYTHON_BUILD_WITH_CYTHON, "
- "but do not have Cython installed. We won't stop you from using "
- "other commands, but the extension files will fail to build.\n")
-elif need_cython:
- sys.stderr.write(
- 'We could not find Cython. Setup may take 10-20 minutes.\n')
- SETUP_REQUIRES += ('cython>=0.23',)
+try:
+ import Cython
+except ImportError:
+ if BUILD_WITH_CYTHON:
+ sys.stderr.write(
+ "You requested a Cython build via GRPC_PYTHON_BUILD_WITH_CYTHON, "
+ "but do not have Cython installed. We won't stop you from using "
+ "other commands, but the extension files will fail to build.\n")
+ elif need_cython:
+ sys.stderr.write(
+ 'We could not find Cython. Setup may take 10-20 minutes.\n')
+ SETUP_REQUIRES += ('cython>=0.23',)
COMMAND_CLASS = {
'doc': commands.SphinxDocumentation,