]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cmake: put cythonized .c files into ${CMAKE_CURRENT_BINARY_DIR}
authorKefu Chai <kchai@redhat.com>
Sat, 9 Jul 2016 04:58:33 +0000 (12:58 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 11 Jul 2016 08:23:20 +0000 (16:23 +0800)
it was put into the directory where .pyx is located. it's not expected
in an out-of-tree build.
* {rados,rbd,cephfs}/setup.py: use build_ext from cython if possible, fallback to
  the one from setuptools or distutils
* Distutils.cmake: pass --cython-c-in-temp --build-temp and
  --cython-include-dirs to "build_ext" command

Signed-off-by: Kefu Chai <kchai@redhat.com>
cmake/modules/Distutils.cmake
src/pybind/cephfs/setup.py
src/pybind/rados/setup.py
src/pybind/rbd/setup.py

index 6ba1c378b9204ab731459de1522e2ec52543d0be..aefcf707e7f049a88057c612f32886abbfa13cee 100644 (file)
@@ -70,6 +70,7 @@ function(distutils_install_cython_module name)
            CFLAGS=\"-iquote ${CMAKE_SOURCE_DIR}/src/include\"
            ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/setup.py
            build --build-base ${CYTHON_MODULE_DIR} --verbose
+           build_ext --cython-c-in-temp --build-temp ${CMAKE_CURRENT_BINARY_DIR} --cython-include-dirs ${PROJECT_SOURCE_DIR}/src/pybind/rados
            install \${options} --single-version-externally-managed --record /dev/null
            egg_info --egg-base ${CMAKE_CURRENT_BINARY_DIR}
            --verbose
index 371358b0dabf3169e4f9818611d9ece29ce417ce..f95cb65a32b865cfd0c90e4fa20f4c975990f32f 100755 (executable)
@@ -6,6 +6,8 @@ from setuptools.command.egg_info import egg_info
 from distutils.core import setup
 from distutils.extension import Extension
 from Cython.Build import cythonize
+from Cython.Distutils import build_ext
+
 
 def get_version():
     try:
@@ -48,6 +50,7 @@ setup(
         os.path.join(os.path.dirname(__file__), "..", "rados")]
     ),
     cmdclass={
+        "build_ext": build_ext,
         "egg_info": EggInfoCommand,
     },
 )
index 9e152bd081f70400443efa700ec6d2e0a62c0716..b3662b2f37ac743584705bcef6e4c844b1f39cc7 100755 (executable)
@@ -130,8 +130,11 @@ def check_sanity():
 if not check_sanity():
     sys.exit(1)
 
+cmdclass = {}
 try:
     from Cython.Build import cythonize
+    from Cython.Distutils import build_ext
+    cmdclass = {'build_ext': build_ext}
 except ImportError:
     print("WARNING: Cython is not installed.")
 
@@ -141,8 +144,6 @@ except ImportError:
     else:
         def cythonize(x, **kwargs):
             return x
-
-
         source = "rados.c"
 else:
     source = "rados.pyx"
@@ -169,6 +170,7 @@ setup(
     ),
     url='https://github.com/ceph/ceph/tree/master/src/pybind/rados',
     license='LGPLv2+',
+    platforms='Linux',
     ext_modules=cythonize(
         [
             Extension(
@@ -191,4 +193,5 @@ setup(
         'Programming Language :: Python :: 3.4',
         'Programming Language :: Python :: 3.5'
     ],
+    cmdclass=cmdclass,
 )
index 79d4d588e259fe10e929ebc42478d93b7e0fd305..c6166f89300bbc2e5cb5492194dd539a64395fe0 100755 (executable)
@@ -6,6 +6,7 @@ from setuptools.command.egg_info import egg_info
 from distutils.core import setup
 from distutils.extension import Extension
 from Cython.Build import cythonize
+from Cython.Distutils import build_ext
 
 def get_version():
     try:
@@ -49,5 +50,6 @@ setup(
     ),
     cmdclass={
         "egg_info": EggInfoCommand,
+        "build_ext": build_ext,
     },
 )