]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: Do not import Cython when invoked using --without-cython
authorAnirudha Bose <ani07nov@gmail.com>
Wed, 25 May 2016 23:19:48 +0000 (04:49 +0530)
committerAnirudha Bose <ani07nov@gmail.com>
Sun, 19 Jun 2016 14:49:32 +0000 (20:19 +0530)
Signed-off-by: Anirudha Bose <ani07nov@gmail.com>
src/pybind/rados/setup.py

index 2303f1759bb09a972adebc9be8d10c47e99ac871..f0d2b9bb98d6c230268e1a2901b49e52716fc1a1 100755 (executable)
@@ -14,8 +14,6 @@ from distutils.errors import CompileError, LinkError
 from distutils.extension import Extension
 from distutils.sysconfig import customize_compiler
 
-from Cython.Build import cythonize
-
 # PEP 440 versioning of the Rados package on PyPI
 # Bump this version, after every changeset
 # NOTE: This version is not the same as get_ceph_version()
@@ -115,13 +113,6 @@ def check_sanity():
 if not check_sanity():
     sys.exit(1)
 
-# Disable cythonification if we're not really building anything
-if (len(sys.argv) >= 2 and
-        any(i in sys.argv[1:] for i in ('--help', 'clean', 'egg_info', '--version')
-            )):
-    def cythonize(x, **kwargs):
-        return x
-
 if '--without-cython' in sys.argv:
     if not os.path.isfile('rados.c'):
         print('Error: Cannot find Cythonized file rados.c', file=sys.stderr)
@@ -136,8 +127,17 @@ if '--without-cython' in sys.argv:
     sys.argv.remove('--without-cython')
     source = "rados.c"
 else:
+    from Cython.Build import cythonize
+
     source = "rados.pyx"
 
+# Disable cythonification if we're not really building anything
+if (len(sys.argv) >= 2 and
+        any(i in sys.argv[1:] for i in ('--help', 'clean', 'egg_info', '--version')
+            )):
+    def cythonize(x, **kwargs):
+        return x
+
 flags = get_python_flags()
 
 setup(