]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CMake: Adding DOCUTILS_ROOT_DIR and SETUPTOOLS_ROOT_DIR to the PYTHONPATH
authorbruneton <bruneton>
Tue, 9 Jul 2013 08:20:43 +0000 (08:20 +0000)
committerbruneton <bruneton>
Tue, 9 Jul 2013 08:20:43 +0000 (08:20 +0000)
when invoking the sphinx-build command.

doc/docutils/CMakeLists.txt
salome_adm/cmake_files/FindSalomeSphinx.cmake

index 5149861529f35b95c595317fdb8d3c7ea402eef2..11bae40afbbcd7a68901dd7d54bad0ddefde48e2 100755 (executable)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
+# This file mainly prepares the environment in which sphinx should run:
+#  this sets the PYTHONPATH and LD_LIBRARY_PATH to include OMNIORB, DOCUTILS, SETUPTOOLS, etc ...
+
+# Prepare Sphinx options
 SET(SPHINXOPTS
 )
 SET(SOURCEDIR
@@ -36,8 +40,13 @@ SET(ALLSPHINXOPTS
 
 SALOME_CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in" "${CMAKE_CURRENT_BINARY_DIR}/conf.py")                
 
+# Write the shell file preparing the env for the Sphinx run:
+#    This uses the paths to SPHINX, DOCUTILS and SETUPTOOLS:
+#    Their root dir were found when looking for Sphinx (FindSalomeSphinx.cmake):
+
+SET(_pydir python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
 IF(WINDOWS)
-  STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\lib\\python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}\\site-packages\\salome\;%PYTHONPATH%
+  STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\lib\\${_pydir}\\site-packages\\salome\;%PYTHONPATH%
   @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\bin\\salome\;%PYTHONPATH%
   @SET PATH=${CMAKE_INSTALL_PREFIX}\\lib\\salome\;%PATH%
   @SET PYTHONPATH=${OMNIORB_ROOT_DIR}\\lib\\x86_win32\;%PYTHONPATH%
@@ -47,15 +56,18 @@ IF(WINDOWS)
   SET(EXT "bat")
   SET(CALL_STR "call")
 ELSE(WINDOWS)
-  SET(SCR  " export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/salome:\${PYTHONPATH}
+  SET(SCR  " export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/${_pydir}/site-packages/salome:\${PYTHONPATH}
   export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/bin/salome:\${PYTHONPATH}
   export LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib/salome:\${LD_LIBRARY_PATH}
   export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages:\${PYTHONPATH}
+  export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
   export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib:\${PYTHONPATH}
-  export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages:\${PYTHONPATH}
+  export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
   export LD_LIBRARY_PATH=${OMNIORB_ROOT_DIR}/lib:\${LD_LIBRARY_PATH}
-  ")
+  export PYTHONPATH=${SETUPTOOLS_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
+  export PYTHONPATH=${DOCUTILS_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
+  export PYTHONPATH=${SPHINX_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}"
+  )
   SET(EXT "sh")
   SET(CALL_STR ".")
 ENDIF(WINDOWS)
index f769a43cbb80f4a9854c6d09d770bb7d697c3321..5775e69ed4c306c49fd7a3fd3ff45c99c2badce9 100644 (file)
 #
 # The caller of this macro might set SPHINX_PYTHONPATH to provide a PYTHONPATH with
 # which the sphinx command should be ran.
+# Note the environment is also overriden in 
+#     doc/docutils/CMakeLists.txt
+# with the creation of a dedicated launcher script.
 #
 
 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Sphinx SPHINX_EXECUTABLE 2)
 
+# Also retrieve paths to DOCUTILS and SETUPTOOLS:
+SET(SETUPTOOLS_ROOT_DIR "$ENV{SETUPTOOLS_ROOT_DIR}" CACHE PATH "Path to the Setuptools installation")
+SET(DOCUTILS_ROOT_DIR "$ENV{DOCUTILS_ROOT_DIR}" CACHE PATH "Path to the Setuptools installation")
+
 # Ensure the command is run with the given PYTHONPATH
-IF(WIN32 AND NOT CYGWIN)
-   MESSAGE(WARNING "Sphinx windows command needs a proper PYTHONPATH to run.")
-ELSE()
-   SET(SPHINX_EXECUTABLE /usr/bin/env PYTHONPATH="${SPHINX_PYTHONPATH}:$ENV{PYTHONPATH}" ${SPHINX_EXECUTABLE})
-ENDIF()
+#IF(WIN32 AND NOT CYGWIN)
+#   MESSAGE(WARNING "Sphinx windows command needs a proper PYTHONPATH to run.")
+#ELSE()
+#   SET(SPHINX_EXECUTABLE /usr/bin/env PYTHONPATH="${SPHINX_PYTHONPATH}:$ENV{PYTHONPATH}" ${SPHINX_EXECUTABLE})
+#ENDIF()
 
 MARK_AS_ADVANCED(SPHINX_EXECUTABLE)
-#message("SPHINX_EXECUTABLE : ${SPHINX_EXECUTABLE}")