Skip to content

Commit

Permalink
Merge pull request #11859 from ceph/wip-py-rgw
Browse files Browse the repository at this point in the history
doc: add python-rgw doc

Reviewed-by: Haomai Wang <haomai@xsky.com>
  • Loading branch information
tchaikov committed Nov 9, 2016
2 parents e1622bc + 8fd9543 commit 88ed951
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 42 deletions.
58 changes: 19 additions & 39 deletions admin/build-doc
Expand Up @@ -72,49 +72,29 @@ mkdir -p $vdir/lib
export LD_LIBRARY_PATH="$vdir/lib"
export PYTHONPATH=$TOPDIR/src/pybind

ln -sf librados.so.2 $vdir/lib/librados.so
gcc -shared -o $vdir/lib/librados.so.2 -xc /dev/null
BUILD_DOC=1 \
CFLAGS="-iquote$TOPDIR/src/include" \
CPPFLAGS="-iquote$TOPDIR/src/include" \
LDFLAGS="-L$vdir/lib -Wl,--no-as-needed" \
$vdir/bin/pip install $TOPDIR/src/pybind/rados
nm $vdir/lib/python*/*-packages/rados.so | grep 'U rados_' | \
awk '{ print "void "$2"(void) {}" }' | \
gcc -shared -o $vdir/lib/librados.so.2 -xc -

# FIXME(sileht): I dunno how to pass the include-dirs correctly with pip
# for build_ext step, it should be:
# --global-option=build_ext --global-option="--cython-include-dirs $TOPDIR/src/pybind/rados/"
# but that doesn't work, so copying the file in the rbd module directly, that's ok for docs
cp -f $TOPDIR/src/pybind/rados/rados.pxd $TOPDIR/src/pybind/rbd/
cp -f $TOPDIR/src/pybind/rados/rados.pxd $TOPDIR/src/pybind/cephfs/

ln -sf librbd.so.1 $vdir/lib/librbd.so
gcc -shared -o $vdir/lib/librbd.so.1 -xc /dev/null
BUILD_DOC=1 \
CFLAGS="-iquote$TOPDIR/src/include" \
CPPFLAGS="-iquote$TOPDIR/src/include" \
LDFLAGS="-L$vdir/lib -Wl,--no-as-needed" \
$vdir/bin/pip install $TOPDIR/src/pybind/rbd
nm $vdir/lib/python*/*-packages/rbd.so | grep 'U rbd_' | \
awk '{ print "void "$2"(void) {}" }' | \
gcc -shared -o $vdir/lib/librbd.so.1 -xc -


ln -sf libcephfs.so.1 $vdir/lib/libcephfs.so
gcc -shared -o $vdir/lib/libcephfs.so.1 -xc /dev/null
BUILD_DOC=1 \
CFLAGS="-iquote$TOPDIR/src/include" \
CPPFLAGS="-iquote$TOPDIR/src/include" \
LDFLAGS="-L$vdir/lib -Wl,--no-as-needed" \
$vdir/bin/pip install $TOPDIR/src/pybind/cephfs
nm $vdir/lib/python*/*-packages/cephfs.so | grep 'U cephfs_' | \
awk '{ print "void "$2"(void) {}" }' | \
gcc -shared -o $vdir/lib/libcephfs.so.1 -xc -

rm -f $TOPDIR/src/pybind/rbd/rados.pxd $TOPDIR/src/pybind/cephfs/rados.pxd

for bind in rados rbd cephfs rgw; do
if [ ${bind} != rados ]; then
cp -f $TOPDIR/src/pybind/rados/rados.pxd $TOPDIR/src/pybind/${bind}/
fi
ln -sf lib${bind}.so.1 $vdir/lib/lib${bind}.so
gcc -shared -o $vdir/lib/lib${bind}.so.1 -xc /dev/null
BUILD_DOC=1 \
CFLAGS="-iquote$TOPDIR/src/include" \
CPPFLAGS="-iquote$TOPDIR/src/include" \
LDFLAGS="-L$vdir/lib -Wl,--no-as-needed" \
$vdir/bin/pip install $TOPDIR/src/pybind/${bind}
# rgwfile_version(), librgw_create(), rgw_mount()
nm $vdir/lib/python*/*-packages/${bind}.so | grep -E "U (lib)?${bind}" | \
awk '{ print "void "$2"(void) {}" }' | \
gcc -shared -o $vdir/lib/lib${bind}.so.1 -xc -
if [ ${bind} != rados ]; then
rm -f $TOPDIR/src/pybind/${bind}/rados.pxd
fi
done

$vdir/bin/sphinx-build -a -n -b dirhtml -d doctrees $TOPDIR/doc $TOPDIR/build-doc/output/html
$vdir/bin/sphinx-build -a -b man -t man -d doctrees $TOPDIR/doc $TOPDIR/build-doc/output/man
Expand Down
6 changes: 6 additions & 0 deletions doc/api/index.rst
Expand Up @@ -26,6 +26,12 @@ See `librbdpy`_.

.. _librbdpy: ../rbd/librbdpy

Ceph RADOS Gateway APIs
=======================

See `librgw-py`_.

.. _librgw-py: ../radosgw/api

Calamari APIs
=============
Expand Down
14 changes: 14 additions & 0 deletions doc/radosgw/api.rst
@@ -0,0 +1,14 @@
===============
librgw (Python)
===============

.. highlight:: python

The `rgw` python module provides file-like access to rgw.

API Reference
=============

.. automodule:: rgw
:members: LibRGWFS, FileHandle

2 changes: 1 addition & 1 deletion src/pybind/rgw/CMakeLists.txt
@@ -1,3 +1,3 @@
distutils_add_cython_module(cython${PYTHON_VERSION}_rgw ${CMAKE_CURRENT_SOURCE_DIR}/rgw_file.pyx)
distutils_add_cython_module(cython${PYTHON_VERSION}_rgw ${CMAKE_CURRENT_SOURCE_DIR}/rgw.pyx)
add_dependencies(cython${PYTHON_VERSION}_rgw rgw)
distutils_install_cython_module(cython${PYTHON_VERSION}_rgw)
2 changes: 1 addition & 1 deletion src/pybind/rgw/MANIFEST.in
@@ -1 +1 @@
include rgw_file.pyx
include rgw.pyx
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pybind/rgw/setup.py
Expand Up @@ -146,7 +146,7 @@ def cythonize(x, **kwargs):

source = "rgw.c"
else:
source = "rgw_file.pyx"
source = "rgw.pyx"

# Disable cythonification if we're not really building anything
if (len(sys.argv) >= 2 and
Expand Down

0 comments on commit 88ed951

Please sign in to comment.