[PATCH 0/8] use distutils to build Python bindings from cmake

Sebastian Ramacher sebastian at ramacher.at
Mon Oct 8 19:33:39 UTC 2012


Hi,

the attached series of patches adds a distutils based setup.py for the Python
bindings which is then called from cmake This approach has the advantage, that
the .so and .py file are installed into the correct location which depends on
the Python version and the platform.

The same trick can be used from automake as well.

Furthermore the examples can be run via make test or ctest. The test suite
for the Python bindings is executed as well.

I don't know if the last patch is really necessary, but according to [1]
ADD_TEST and WORKING DIRECTORY seem to be buggy.

It'd be great if you could apply these patches and eventually release a new
version of kdtree++. I plan to use them in new version of Debian's kdtree++
package to ship the Python bindings for all supported versions of Python.

[1] http://cmake.3232098.n2.nabble.com/add-test-WORKING-DIRECTORY-option-td6170746.html

Sebastian Ramacher (8):
  Close file handles properly
  Fix Python 3 incompatibilities
  Enable testing and add test cases
  Install headers in correct location
  Rename py-kdtree_test.py to something importable.
  Add setup.py to build the Python bindings
  Use setup.py from cmake to build the Python bindings
  Bump required cmake version

 CMakeLists.txt                                     |    5 +-
 examples/CMakeLists.txt                            |    4 ++
 python-bindings/CMakeLists.txt                     |   61 +++++++++++++++-----
 python-bindings/gen-swig-hpp.py                    |    4 +-
 .../{py-kdtree_test.py => py_kdtree_test.py}       |    3 +
 python-bindings/setup.py                           |   44 ++++++++++++++
 python-bindings/setup_py_with_destdir.cmake        |   25 ++++++++
 7 files changed, 129 insertions(+), 17 deletions(-)
 rename python-bindings/{py-kdtree_test.py => py_kdtree_test.py} (99%)
 create mode 100644 python-bindings/setup.py
 create mode 100644 python-bindings/setup_py_with_destdir.cmake

-- 
1.7.10.4




More information about the libkdtree-devel mailing list