You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2019/08/21 14:16:10 UTC

[qpid-proton] branch shinx-docs updated: PROTON-2086: Fixed some issues in cmake as pointed out by astitcher, removed unneeded makefile and removed a trailing comma in a list.

This is an automated email from the ASF dual-hosted git repository.

kpvdr pushed a commit to branch shinx-docs
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/shinx-docs by this push:
     new 41f563c  PROTON-2086: Fixed some issues in cmake as pointed out by astitcher, removed unneeded makefile and removed a trailing comma in a list.
41f563c is described below

commit 41f563c1e35719e0e613e3d7cad66c69d8f5ff8c
Author: Kim van der Riet <kv...@localhost.localdomain>
AuthorDate: Wed Aug 21 10:15:44 2019 -0400

    PROTON-2086: Fixed some issues in cmake as pointed out by astitcher, removed unneeded makefile and removed a trailing comma in a list.
---
 python/CMakeLists.txt  | 56 ++++++++++++++++----------------------------------
 python/docs/Makefile   | 20 ------------------
 python/proton/utils.py |  2 +-
 3 files changed, 19 insertions(+), 59 deletions(-)

diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index a664793..5657105 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -112,45 +112,25 @@ endmacro(py_compile)
 py_compile(${CMAKE_CURRENT_BINARY_DIR} ${pysrc-generated} CPROTON_ARTIFACTS)
 py_compile(${CMAKE_CURRENT_SOURCE_DIR} "${pysrc}" PROTON_ARTIFACTS)
 
-
-find_program(SPHINX_EXE_PY2 sphinx-build-2 HINTS "/usr/bin")
-mark_as_advanced (SPHINX_EXE_PY2)
-find_program(SPHINX_EXE_PY3 sphinx-build-3 HINTS "/usr/bin")
-mark_as_advanced (SPHINX_EXE_PY3)
-
-# Version of Python used to build API must match version of Sphinx used to build the docs
-get_filename_component(PYTHON_EXECUTABLE_NAME ${PYTHON_EXECUTABLE} NAME)
-# Try matching for Python 3 first
-if ((SPHINX_EXE_PY3) AND (PYTHON_EXECUTABLE_NAME STREQUAL "python3"))
-    set(BUILD_SPHINX_DOCS TRUE)
-    set(SPHINX_EXE ${SPHINX_EXE_PY3})
-# Python 2 match
-elseif ((SPHINX_EXE_PY2) AND (PYTHON_EXECUTABLE_NAME STREQUAL "python"))
-    set(BUILD_SPHINX_DOCS TRUE)
-    set(SPHINX_EXE ${SPHINX_EXE_PY2})
-# No match found
+# Sphinx documentation
+check_python_module("sphinx" SPHINX_MODULE_FOUND)
+if (SPHINX_MODULE_FOUND)
+    message(STATUS "Python Sphinx module found - doc generation enabled.")
+    add_custom_target(docs-py
+        COMMAND ${PN_ENV_SCRIPT} --
+        PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_CURRENT_SOURCE_DIR}
+        LD_LIBRARY_PATH="${CMAKE_CURRENT_BINARY_DIR}/c"
+        ${PYTHON_EXECUTABLE} -m sphinx "${CMAKE_CURRENT_SOURCE_DIR}/docs" "${CMAKE_CURRENT_BINARY_DIR}/docs")
+    add_dependencies(docs docs-py)
+    install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/docs/"
+            DESTINATION "${PROTON_SHARE}/docs/api-py"
+            COMPONENT documentation
+            OPTIONAL)
 else ()
-    set(BUILD_SPHINX_DOCS FALSE)
-    message(WARNING "Python - Sphinx version mismatch - no Python API docs will be generated.")
-    message("Python executable used to build Proton: ${PYTHON_EXECUTABLE_NAME}")
-    if (SPHINX_EXE_PY2)
-        message("Sphinx for Python2 found: ${SPHINX_EXE_PY2}")
-    endif ()
-    if (SPHINX_EXE_PY3)
-        message("Sphinx for Python3 found: ${SPHINX_EXE_PY3}")
-    endif ()
-endif ()
-if (BUILD_SPHINX_DOCS)
-   add_custom_target(docs-py
-     COMMAND ${PN_ENV_SCRIPT} --
-         PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR}:${CMAKE_CURRENT_BINARY_DIR}
-         LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/c
-         ${SPHINX_EXE} -b html ${CMAKE_CURRENT_SOURCE_DIR}/docs ${CMAKE_CURRENT_BINARY_DIR}/docs)
-   add_dependencies(docs docs-py)
-   install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/docs/"
-           DESTINATION "${PROTON_SHARE}/docs/api-py"
-           COMPONENT documentation
-           OPTIONAL)
+    execute_process(COMMAND ${PYTHON_EXECUTABLE} --version
+                    ERROR_VARIABLE PYTHYON_VERSION_ERR)
+    string(STRIP ${PYTHYON_VERSION_ERR} PYTHON_VERSION_STR)
+    message(WARNING "Sphinx module NOT found for ${PYTHON_VERSION_STR} - doc generation disabled.")
 endif ()
 
 install(FILES ${CPROTON_ARTIFACTS}
diff --git a/python/docs/Makefile b/python/docs/Makefile
deleted file mode 100644
index 03a8aee..0000000
--- a/python/docs/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# Minimal makefile for Sphinx documentation
-#
-
-# You can set these variables from the command line.
-SPHINXOPTS    =
-SPHINXBUILD   = sphinx-build
-SPHINXPROJ    = QpidProtonPythonAPI
-SOURCEDIR     = .
-BUILDDIR      = _build
-
-# Put it first so that "make" without argument is like "make help".
-help:
-	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
-
-.PHONY: help Makefile
-
-# Catch-all target: route all unknown targets to Sphinx using the new
-# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
-%: Makefile
-	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
\ No newline at end of file
diff --git a/python/proton/utils.py b/python/proton/utils.py
index abec651..fb514c6 100644
--- a/python/proton/utils.py
+++ b/python/proton/utils.py
@@ -28,5 +28,5 @@ __all__ = [
     'SyncRequestResponse',
     'SendException',
     'LinkDetached',
-    'ConnectionClosed',
+    'ConnectionClosed'
 ]


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org