Commit Graph

15 Commits

Author SHA1 Message Date
Oleh Prypin 5683a8259b cmake: Also build Python bindings for Python 3
Signed-off-by: Oleh Prypin <oleh@pryp.in>
2016-08-11 16:36:57 +03:00
Kefu Chai 5444721b1d cmake: install platlib into a subdir of build-base dir
distutils' install command installs all stuff under $build-base, which
includes the temporary files. and rpm packaging does not like::
  Installed (but unpackaged) file(s)
and to support both py2 and py3, we should encode the python version
into the path, otherwise the built files will be overwritten.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-08-11 00:14:17 +08:00
Kefu Chai 300aedd8a6 cmake: fix wrong path introduced by bb163e9
s/CYTHON_MODULE_LIB/CYTHON_MODULE_DIR/

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-08-10 15:59:30 +08:00
Kefu Chai bb163e98c0 cmake: specify distutils build path explicitly
so we don't need to replicate the logic in distutils/command/build.py
at different places.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-08-10 09:58:22 +08:00
Kefu Chai 333877023e doc,pybind: bypass sanity check if building doc
the empty .so file does not compile at all, so we need to bypass the
sanity check, if we are building docs. and what sphinx needs is just the
docstrings.

Fixes: http://tracker.ceph.com/issues/16940
Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-08-09 17:08:45 +08:00
Kefu Chai c57dbd3451 cmake: pass necessary cflags to build_ext
this fixes:
```
creating
/home/kefu/ceph/build/src/pybind/rados/var/ceph/ceph/build/src/pybind/rados
creating
/home/kefu/ceph/build/src/pybind/rados/var/ceph/ceph/build/src/pybind/rados/pyrex
/usr/bin/gcc-6 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes
-fno-strict-aliasing -iquote /var/ceph/ceph/src/include -fPIC
-I/usr/include/python2.7 -I/usr/include/x86_64-linux-
gnu/python2.7 -I/usr/include/python2.7 -c
/home/kefu/ceph/build/src/pybind/rados/pyrex/rados.c -o
/home/kefu/ceph/build/src/pybind/rados/var/ceph/ceph/build/src/pybind/rados/pyrex/ra
dos.o -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g
-fstack-protector-strong -Wformat -Werror=format-security -DNDEBUG -g
-fwrapv -O2 -Wall -Wstrict-prototypes -lpython2.
7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1
-Wl,-Bsymbolic-functions
/home/kefu/ceph/build/src/pybind/rados/pyrex/rados.c:239:28: fatal error:
rados/librados.h: No such file or directory
 #include "rados/librados.h"
                            ^
compilation terminated.
```

seems we can not pass the CFLAGS with space in it to setup.py using env variable

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-07-11 16:23:20 +08:00
Kefu Chai 6a99eec653 cmake: put cythonized .c files into ${CMAKE_CURRENT_BINARY_DIR}
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>
2016-07-11 16:23:20 +08:00
Kefu Chai edd7c9d709 cmake: creage egg_info files into build directory
otherwise they will go to the source tree, and "git ls-files" will list
them as untracked files, which annoy gitbuilder-ceph-tarball*-cmake
gitbuilders. like

+ echo 'error: Added files:'
error: Added files:
+ cat .git/added-files
src/pybind/rados/rados.egg-info/PKG-INFO
...

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-07-08 15:02:59 +08:00
Josh Durgin 1c7ad3523d Merge pull request #9833 from onyb/wip-rados-pypi
pybind: make rados ready for PyPI

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
Reviewed-by: Kefu Chai <kchai@redhat.com>
2016-07-06 16:01:50 -07:00
Kefu Chai 0c5fb822dd cmake: refactor distutils_install_module to follow the pattern of distutils_install_cython_module
Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-07-04 11:49:26 +08:00
Kefu Chai 8c9ff9c5cb cmake: install python packages into $CMAKE_INSTALL_PREFIX
* Distutils.cmake:
  set --prefix=${CMAKE_INSTALL_PREFIX} for python packages installed using
  setuptools. it was set to --prefix=/user only when $DESTDIR is set. so
  if user installs ceph using -DCMAKE_INSTALL_PREFIX, these python
  packages still go to /usr, which is unexpected.
* ceph-disk/CMakeLists.txt:
  install script into ${CMAKE_INSTALL_SBINDIR} instead of /usr/sbin

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-07-04 11:49:26 +08:00
Anirudha Bose 9a1d64c93d pybind: Add CMake support in rados
Signed-off-by: Anirudha Bose <ani07nov@gmail.com>
2016-06-19 20:20:56 +05:30
Kefu Chai c4a8784330 cmake: install ceph-disk to /usr/sbin
* add keyword "INSTALL_SCRIPT" to distutils_install_module(), so we can
  override the install path of ceph-disk script.
* refactor the Distutils.cmake module a little bit, the ${option}
  variable out lives the CODE snipplet. so we need to reset it
  at the beginning.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-06-04 09:37:33 +08:00
Kefu Chai bbf51e1562 cmake: install cython modules
* fix CYTHON_ADD_MODULE() macro. because python_add_module() offered by
  FindPythonLibs.cmake creates a target with name of ${name}, which conflicts
  with existing targets like "rbd" or "rados". so we can not reuse the
  name in ${name}.pyx. and instead, we should specify the target name
  explicitly.
* add distutils_install_cython_module() function to build and install
  cython modules.
* we can split build and install of cython module, but the install phase
  always tries to build the module. so keep it this way. will look at it
  later on.
* move the variables initializations into the Distutils.cmake module.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-06-01 23:50:05 +08:00
Kefu Chai b02aaebc45 cmake: install ceph-{detect-init,disk}
add a cmake module named Distutils.cmake for setting up python modules
using setup.py.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-06-01 23:49:46 +08:00