From b0cb7718b2ba6c02577938a532c1d5e5cdc5e53c Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Tue, 26 May 2015 10:46:57 -0400 Subject: [PATCH] Cleaned up python docs generation. The script to generate Python docs has been cleaned up and simplified. The python-sphinx configuration files have been moved into base/common/python. The build artifacts are now created in the build/base/common/python. --- base/common/CMakeLists.txt | 10 +--- base/common/python/CMakeLists.txt | 63 +++++++++++++++++++++++++ base/common/python/{docs/conf.py.in => conf.py} | 2 +- base/common/python/docs/CMakeLists.txt | 55 --------------------- base/common/python/{docs => }/index.rst | 0 base/common/python/{docs => }/pki.rst | 0 specs/pki-core.spec | 2 +- 7 files changed, 66 insertions(+), 66 deletions(-) create mode 100644 base/common/python/CMakeLists.txt rename base/common/python/{docs/conf.py.in => conf.py} (99%) delete mode 100644 base/common/python/docs/CMakeLists.txt rename base/common/python/{docs => }/index.rst (100%) rename base/common/python/{docs => }/pki.rst (100%) diff --git a/base/common/CMakeLists.txt b/base/common/CMakeLists.txt index 37139f78f8513bb50c3a712627eca53974edc71a..ee401f201429167b67348c35c9c89c3d52b3c3fd 100644 --- a/base/common/CMakeLists.txt +++ b/base/common/CMakeLists.txt @@ -25,14 +25,6 @@ install( ${SYSCONF_INSTALL_DIR}/pki/ ) -# install Python libraries -install( - DIRECTORY - python/ - DESTINATION - ${PYTHON_SITE_PACKAGES} -) - # install executables install( FILES @@ -105,4 +97,4 @@ install( ) add_subdirectory(src) -add_subdirectory(python/docs) +add_subdirectory(python) diff --git a/base/common/python/CMakeLists.txt b/base/common/python/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c2fad86919a328ab4f507b610ffa26c087da49b --- /dev/null +++ b/base/common/python/CMakeLists.txt @@ -0,0 +1,63 @@ +find_package(Sphinx REQUIRED) + +if(NOT DEFINED SPHINX_THEME) + set(SPHINX_THEME default) +endif() + +if(NOT DEFINED SPHINX_THEME_DIR) + set(SPHINX_THEME_DIR) +endif() + +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/conf.py" + "${CMAKE_CURRENT_BINARY_DIR}/conf.py" + @ONLY) + +add_custom_target(dogtag_python_client_docs ALL + ${SPHINX_EXECUTABLE} + -b html + -c "${CMAKE_CURRENT_BINARY_DIR}" + -w "${CMAKE_CURRENT_BINARY_DIR}/python-client-lib-html.log" + -a + "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}/html" + COMMENT "Building Python Client Library HTML documentation") + +add_custom_target(dogtag_python_client_man_docs ALL + ${SPHINX_EXECUTABLE} + -b man + -c "${CMAKE_CURRENT_BINARY_DIR}" + -w "${CMAKE_CURRENT_BINARY_DIR}/python-client-lib-man.log" + -a + "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}/man" + COMMENT "Building Python Client Library manual pages") + +install( + DIRECTORY + pki + DESTINATION + ${PYTHON_SITE_PACKAGES} +) + +install( + DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/html + DESTINATION + ${SHARE_INSTALL_PREFIX}/doc/pki-base/ + PATTERN + .buildinfo EXCLUDE + PATTERN + .doctrees EXCLUDE +) + +install( + DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/man/ + DESTINATION + ${MAN_INSTALL_DIR}/man1 + PATTERN + .buildinfo EXCLUDE + PATTERN + .doctrees EXCLUDE +) diff --git a/base/common/python/docs/conf.py.in b/base/common/python/conf.py similarity index 99% rename from base/common/python/docs/conf.py.in rename to base/common/python/conf.py index d6f55e4653bf66504756de4a652ed9c0931a07c9..67c59e610500aa4615e710f35a451c885791db1a 100644 --- a/base/common/python/docs/conf.py.in +++ b/base/common/python/conf.py @@ -16,7 +16,7 @@ import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath('../pki')) +sys.path.insert(0, os.path.abspath('pki')) # -- General configuration ----------------------------------------------------- diff --git a/base/common/python/docs/CMakeLists.txt b/base/common/python/docs/CMakeLists.txt deleted file mode 100644 index 86bb590f388fccd65ad2a1b8749b42cc82955582..0000000000000000000000000000000000000000 --- a/base/common/python/docs/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -find_package(Sphinx REQUIRED) - -if(NOT DEFINED SPHINX_THEME) - set(SPHINX_THEME default) -endif() - -if(NOT DEFINED SPHINX_THEME_DIR) - set(SPHINX_THEME_DIR) -endif() - -# configured documentation tools and intermediate build results -set(BINARY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/_build") - -# Sphinx cache with pickled ReST documents -set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees") - -# HTML output directory -set(SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/../../../../../base/common/html") - -# MAN output directory -set(SPHINX_MAN_DIR "${CMAKE_CURRENT_BINARY_DIR}/../../../../../base/common/man/man1") - -# HTML log file -set(SPHINX_HTML_LOG_FILE "${CMAKE_CURRENT_BINARY_DIR}/../../../../../../../pki-common-sphinx-http.log") - -# MAN log file -set(SPHINX_MAN_LOG_FILE "${CMAKE_CURRENT_BINARY_DIR}/../../../../../../../pki-common-sphinx-man.log") - -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in" - "${BINARY_BUILD_DIR}/conf.py" - @ONLY) - -add_custom_target(dogtag_python_client_docs ALL - ${SPHINX_EXECUTABLE} - -b html - -c "${BINARY_BUILD_DIR}" - -d "${SPHINX_CACHE_DIR}" - -w "${SPHINX_HTML_LOG_FILE}" - -a - "${CMAKE_CURRENT_SOURCE_DIR}" - "${SPHINX_HTML_DIR}" - COMMENT "Building HTML documentation with Sphinx") - -add_custom_target(dogtag_python_client_man_docs ALL - ${SPHINX_EXECUTABLE} - -b man - -c "${BINARY_BUILD_DIR}" - -d "${SPHINX_CACHE_DIR}" - -w "${SPHINX_MAN_LOG_FILE}" - -a - "${CMAKE_CURRENT_SOURCE_DIR}" - "${SPHINX_MAN_DIR}" - COMMENT "Building man page documentation with Sphinx") - diff --git a/base/common/python/docs/index.rst b/base/common/python/index.rst similarity index 100% rename from base/common/python/docs/index.rst rename to base/common/python/index.rst diff --git a/base/common/python/docs/pki.rst b/base/common/python/pki.rst similarity index 100% rename from base/common/python/docs/pki.rst rename to base/common/python/pki.rst diff --git a/specs/pki-core.spec b/specs/pki-core.spec index ff8393c75456f1cacdf5538a56dc7958b82f6b93..4dbae3b7bbb9c405df850f8eccdb316beeb0e086 100644 --- a/specs/pki-core.spec +++ b/specs/pki-core.spec @@ -792,7 +792,7 @@ systemctl daemon-reload %files -n pki-base %defattr(-,root,root,-) %doc base/common/LICENSE -%doc base/common/html/ +%doc %{_datadir}/doc/pki-base/html %dir %{_datadir}/pki %{_datadir}/pki/VERSION %{_datadir}/pki/etc/ -- 1.9.3