summaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorHector Martin <marcan@marcan.st>2015-12-01 15:30:01 +0100
committerHector Martin <marcan@marcan.st>2015-12-01 16:41:17 +0100
commit9cca28a917131ccbfa37258e7768e56a31f313dc (patch)
tree2f6ab18d2d5424c37742ac3281761bcb310241c7 /admin
parentdebian/control: make python-rbd depend on minimum librbd version (diff)
downloadceph-9cca28a917131ccbfa37258e7768e56a31f313dc.tar.xz
ceph-9cca28a917131ccbfa37258e7768e56a31f313dc.zip
pybind: convert librbd bindings to Cython
ctypes is fundamentally incapable of providing safe callback support (exceptions during callbacks are not handled properly). To fix this, and also gain more flexibility, rewrite/port the librbd bindings to Cython instead. Other Python bindings are expected to migrate to Cython in the future. Reference: http://tracker.ceph.com/issues/13115 To support this, this change also: - Introduces a Makefile for pybind which calls setup.py - Updates the installation files for packages - Adds a hack to admin/build-doc to build a dummy librbd, avoiding the need to build the entire client library just to generate documentation (Sphinx needs to be able to import rbd.so, which depends on librbd.so symbols). With contributions by Josh Durgin <jdurgin@redhat.com> Signed-off-by: Hector Martin <marcan@marcan.st>
Diffstat (limited to 'admin')
-rwxr-xr-xadmin/build-doc18
1 files changed, 17 insertions, 1 deletions
diff --git a/admin/build-doc b/admin/build-doc
index 37411667dcf..728f7ad5d30 100755
--- a/admin/build-doc
+++ b/admin/build-doc
@@ -63,7 +63,23 @@ $vdir/bin/pip install --quiet -r ../admin/doc-requirements.txt
install -d -m0755 \
output/html \
output/man
-PYTHONPATH=`pwd`/../src/pybind $vdir/bin/sphinx-build -a -n -b dirhtml -d doctrees ../doc output/html
+
+# To avoid having to build librbd to build the Python bindings to build the docs,
+# create a dummy librbd.so that allows the module to be imported by sphinx.
+mkdir -p $vdir/lib
+export LD_LIBRARY_PATH="$vdir/lib"
+export PYTHONPATH=`pwd`/../src/pybind
+ln -sf librbd.so.1 $vdir/lib/librbd.so
+gcc -shared -o $vdir/lib/librbd.so.1 -xc /dev/null
+CFLAGS="-iquote `pwd`/../src/include" \
+ CPPFLAGS="-iquote `pwd`/../src/include" \
+ LDFLAGS="-L$vdir/lib -Wl,--no-as-needed" \
+ $vdir/bin/pip install `pwd`/../src/pybind
+nm $vdir/lib/python*/*-packages/rbd.so | grep 'U rbd_' | \
+ awk '{ print "void "$2"(void) {}" }' | \
+ gcc -shared -o $vdir/lib/librbd.so.1 -xc -
+
+$vdir/bin/sphinx-build -a -n -b dirhtml -d doctrees ../doc output/html
$vdir/bin/sphinx-build -a -b man -d doctrees ../doc output/man
#