From 8a22b7c6111b41e91766cdd53c0116b845e068b5 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 12 Sep 2017 21:47:19 +0000 Subject: Fix sphinx build for python3 on Ubuntu git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cythonization_improvement@2667 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: c720b8be2919344e06f3d71cefdd7693439f63f0 --- src/cmake/modules/GUDHI_third_party_libraries.cmake | 2 +- src/cython/CMakeLists.txt | 9 +++------ src/cython/doc/python3-sphinx-build.in | 11 ----------- src/cython/doc/python3-sphinx-build.py | 11 +++++++++++ 4 files changed, 15 insertions(+), 18 deletions(-) delete mode 100755 src/cython/doc/python3-sphinx-build.in create mode 100755 src/cython/doc/python3-sphinx-build.py diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index dbf2106a..f2bbafdc 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -123,7 +123,7 @@ if(PYTHONINTERP_FOUND AND CYTHON_FOUND) find_program( SPHINX_PATH sphinx-build ) elseif(PYTHON_VERSION_MAJOR EQUAL 3) # No sphinx-build in Pyton3, just hack it - set(SPHINX_PATH "${CMAKE_CURRENT_BINARY_DIR}/${GUDHI_CYTHON_PATH}/doc/python3-sphinx-build") + set(SPHINX_PATH "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/${GUDHI_CYTHON_PATH}/doc/python3-sphinx-build.py") else() message(FATAL_ERROR "ERROR: Try to compile the Cython interface. Python version ${PYTHON_VERSION_STRING} is not valid.") endif(PYTHON_VERSION_MAJOR EQUAL 2) diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index baeeb203..d1761f47 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -75,7 +75,7 @@ if(CYTHON_FOUND) if (NOT CGAL_VERSION VERSION_LESS 4.8.1) set(GUDHI_CYTHON_BOTTLENECK_DISTANCE "include '${CMAKE_CURRENT_SOURCE_DIR}/cython/bottleneck_distance.pyx'") - endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) + endif (NOT CGAL_VERSION VERSION_LESS 4.8.1) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) set(GUDHI_CYTHON_SUBSAMPLING "include '${CMAKE_CURRENT_SOURCE_DIR}/cython/subsampling.pyx'") set(GUDHI_CYTHON_TANGENTIAL_COMPLEX "include '${CMAKE_CURRENT_SOURCE_DIR}/cython/tangential_complex.pyx'") @@ -300,20 +300,17 @@ if(CYTHON_FOUND) # Documentation generation is available through sphinx - requires all modules if(SPHINX_PATH AND NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) - # set sphinx-build in make files - configure_file(doc/python3-sphinx-build.in "${CMAKE_CURRENT_BINARY_DIR}/doc/python3-sphinx-build" @ONLY) - # sphinx target requires gudhi.so, because conf.py reads gudhi version from it add_custom_target(sphinx WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}" - ${SPHINX_PATH} -b html . "${CMAKE_CURRENT_BINARY_DIR}/sphinx" + ${SPHINX_PATH} -b html ${CMAKE_CURRENT_SOURCE_DIR}/doc sphinx DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so") add_test(NAME sphinx_py_test WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}" - ${SPHINX_PATH} -b doctest ${CMAKE_CURRENT_SOURCE_DIR}/doc "${CMAKE_CURRENT_BINARY_DIR}/sphinx") + ${SPHINX_PATH} -b doctest ${CMAKE_CURRENT_SOURCE_DIR}/doc doctest) endif(SPHINX_PATH AND NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) endif(CYTHON_FOUND) diff --git a/src/cython/doc/python3-sphinx-build.in b/src/cython/doc/python3-sphinx-build.in deleted file mode 100755 index c97965f5..00000000 --- a/src/cython/doc/python3-sphinx-build.in +++ /dev/null @@ -1,11 +0,0 @@ -#!@PYTHON_EXECUTABLE@ - -""" -Emulate sphinx-build for python3 -""" - -from sys import exit, argv -from sphinx import main - -if __name__ == '__main__': - exit(main(argv)) diff --git a/src/cython/doc/python3-sphinx-build.py b/src/cython/doc/python3-sphinx-build.py new file mode 100755 index 00000000..44b94169 --- /dev/null +++ b/src/cython/doc/python3-sphinx-build.py @@ -0,0 +1,11 @@ +#!/usr/bin/python3 + +""" +Emulate sphinx-build for python3 +""" + +from sys import exit, argv +from sphinx import main + +if __name__ == '__main__': + exit(main(argv)) -- cgit v1.2.3