]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: Improvements to Cython build
authorHector Martin <marcan@marcan.st>
Wed, 2 Dec 2015 13:34:41 +0000 (22:34 +0900)
committerHector Martin <marcan@marcan.st>
Wed, 2 Dec 2015 17:59:33 +0000 (02:59 +0900)
- Avoid a silly rebuild at install time by always using src/build explicitly as build dir
- Tell Cython to put rbd.c in the build dir instead of in the source

This should fix a race when librbd gets relinked at the same time as pybind is installed
(since that install was causing a rebuild too).

Signed-off-by: Hector Martin <marcan@marcan.st>
src/pybind/.gitignore
src/pybind/Makefile.am
src/pybind/setup.py

index 3df399c80fe3205108e7777aaaad0b71a24e4a7c..225fc6f665041d5b55e2f00b3a1e275e9b0317ac 100644 (file)
@@ -1,2 +1 @@
 /__pycache__
-/rbd.c
index dcd8d109dddd811f597ae736e8be633fd4430df5..fd23fcb52f48a3cf560374716510a2bbad5cb16f 100644 (file)
@@ -9,6 +9,7 @@ PY_DISTUTILS = \
        CPPFLAGS="-iquote \${abs_srcdir}/include ${AM_CPPFLAGS} ${CPPFLAGS}" \
        CFLAGS="-iquote \${abs_srcdir}/include ${AM_CFLAGS} ${CFLAGS}" \
        LDFLAGS="-L\${abs_builddir}/.libs $(subst -pie,,${AM_LDFLAGS}) ${LDFLAGS}" \
+       CYTHON_BUILD_DIR="$(shell readlink -f $(builddir))/build" \
        ${PYTHON} ./setup.py
 
 pybind-all: librbd.la ${srcdir}/ceph_ver.h
@@ -32,7 +33,9 @@ pybind-install-exec: ${srcdir}/ceph_ver.h
        else \
                options=--prefix=$(prefix) ; \
        fi ; \
-       cd $(srcdir)/pybind; $(PY_DISTUTILS) install \
+       cd $(srcdir)/pybind; $(PY_DISTUTILS) build \
+       --build-base $(shell readlink -f $(builddir))/build \
+       install \
        $$options $$root \
        --single-version-externally-managed \
        --record /dev/null \
index 8eb2e69986ced326604cf80c4e284c62bdc91433..1eda454c392cb984ecb5ecc3487616aef38ab7d9 100755 (executable)
@@ -29,7 +29,8 @@ class EggInfoCommand(egg_info):
 if (len(sys.argv) >= 2 and
     any(i in sys.argv[1:] for i in ('--help', 'clean', 'egg_info', '--version')
     )):
-    cythonize = lambda x: x
+    def cythonize(x, **kwargs):
+        return x
 
 setup(
     name = 'rbd',
@@ -43,7 +44,7 @@ setup(
             ["rbd.pyx"],
             libraries=["rbd"]
             )
-    ]),
+    ], build_dir=os.environ.get("CYTHON_BUILD_DIR", None)),
     cmdclass={
         "egg_info": EggInfoCommand,
     },