This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
commit f6dd919f092ec0e5343fe41391dc70d2d370759a Author: Andrew Stitcher <[email protected]> AuthorDate: Mon Nov 16 23:37:23 2026 -0500 PROTON-3008: Fix Python documentation build for Sphinx 9 Versions - Use the proton module built for testing for the doc build. - Fix some small doc nits --- python/CMakeLists.txt | 90 +++++++++++++++++++++++----------------------- python/docs/conf.py | 8 ++--- python/proton/_delivery.py | 2 +- python/proton/_events.py | 1 + 4 files changed, 52 insertions(+), 49 deletions(-) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 99c187507..2f15682dc 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -71,6 +71,7 @@ if (NOT SPHINX_MODULE_FOUND) message(STATUS "Sphinx modules not found; doc generation disabled.") else () add_custom_target(docs-py + DEPENDS .timestamp.test_env COMMAND ${PN_ENV_SCRIPT} -- PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_CURRENT_SOURCE_DIR} LD_LIBRARY_PATH="${CMAKE_CURRENT_BINARY_DIR}/c" @@ -188,10 +189,51 @@ if (BUILD_MODULE_FOUND AND add_custom_target(pydist ALL DEPENDS .timestamp.dist) endif () +set (py_bin "${CMAKE_CURRENT_BINARY_DIR}") + +if (ENABLE_PYTHON_ISOLATED) + # Create Python virtual environment to run tests + set(pytest_venv "${py_bin}/pytest_env") + # Have to use a conditional here as you can't use generator expressions in OUTPUT or BYPRODUCTS + if (WIN32) + set(py_venv_bin "Scripts") + else() + set(py_venv_bin "bin") + endif() + set(pytest_bin "${pytest_venv}/${py_venv_bin}") + set(pytest_executable "${pytest_bin}/python${CMAKE_EXECUTABLE_SUFFIX}") + + add_custom_command( + OUTPUT .timestamp.test_env + COMMAND ${Python_EXECUTABLE} -m venv ${pytest_venv} + COMMAND ${pytest_executable} -m pip install --disable-pip-version-check cffi "${python_coverage_module}" + COMMAND ${CMAKE_COMMAND} -E env + "CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}" + "QPID_PROTON_CORE_TARGET_DIR=$<TARGET_FILE_DIR:qpid-proton-core>" + "QPID_PYTHON_UNBUNDLING=devtree" + ${pytest_executable} -m pip install -e . + COMMAND ${pytest_executable} -m pip freeze > ${pytest_venv}/env.txt + COMMAND ${CMAKE_COMMAND} -E touch .timestamp.test_env + BYPRODUCTS ${pytest_executable} + ) +elseif(CFFI_MODULE_FOUND) + set(pytest_executable "${Python_EXECUTABLE}") + set(pytest_venv "${py_bin}") + add_custom_command( + OUTPUT .timestamp.test_env + COMMAND ${CMAKE_COMMAND} -E remove -f ${pytest_venv}/env.txt + COMMAND ${CMAKE_COMMAND} -E env + "CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}" + "QPID_PROTON_CORE_TARGET_DIR=$<TARGET_FILE_DIR:qpid-proton-core>" + ${pytest_executable} ext_build_devtree.py + COMMAND ${CMAKE_COMMAND} -E touch .timestamp.test_env + DEPENDS pysrc_copied qpid-proton-core + ) +endif() + if (BUILD_TESTING) # python test: python/tests/proton-test set (py_src "${CMAKE_CURRENT_SOURCE_DIR}") - set (py_bin "${CMAKE_CURRENT_BINARY_DIR}") # These are only needed on Windows due to build differences set (py_bld "$<$<PLATFORM_ID:Windows>:$<TARGET_FILE_DIR:qpid-proton-core>>") set (py_tests "${py_src}/tests") @@ -207,51 +249,11 @@ if (BUILD_TESTING) set (python_coverage_options -m ${python_coverage_module} run --branch --parallel-mode) endif(CMAKE_BUILD_TYPE MATCHES "Coverage") - if (ENABLE_PYTHON_ISOLATED) - # Create Python virtual environment to run tests - set(pytest_venv "${py_bin}/pytest_env") - # Have to use a conditional here as you can't use generator expressions in OUTPUT or BYPRODUCTS - if (WIN32) - set(py_venv_bin "Scripts") - else() - set(py_venv_bin "bin") - endif() - set(pytest_bin "${pytest_venv}/${py_venv_bin}") - set(pytest_executable "${pytest_bin}/python${CMAKE_EXECUTABLE_SUFFIX}") - - add_custom_command( - OUTPUT .timestamp.test_env - COMMAND ${Python_EXECUTABLE} -m venv ${pytest_venv} - COMMAND ${pytest_executable} -m pip install --disable-pip-version-check cffi "${python_coverage_module}" - COMMAND ${CMAKE_COMMAND} -E env - "CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}" - "QPID_PROTON_CORE_TARGET_DIR=$<TARGET_FILE_DIR:qpid-proton-core>" - "QPID_PYTHON_UNBUNDLING=devtree" - ${pytest_executable} -m pip install -e . - COMMAND ${pytest_executable} -m pip freeze > ${pytest_venv}/env.txt - COMMAND ${CMAKE_COMMAND} -E touch .timestamp.test_env - BYPRODUCTS ${pytest_executable} - ) - add_custom_target(pytest_cffi ALL DEPENDS .timestamp.test_env) - elseif(CFFI_MODULE_FOUND) - set(pytest_executable "${Python_EXECUTABLE}") - set(pytest_venv "${py_bin}") - add_custom_command( - OUTPUT .timestamp.test_env - COMMAND ${CMAKE_COMMAND} -E remove -f ${pytest_venv}/env.txt - COMMAND ${CMAKE_COMMAND} -E env - "CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}" - "QPID_PROTON_CORE_TARGET_DIR=$<TARGET_FILE_DIR:qpid-proton-core>" - ${pytest_executable} ext_build_devtree.py - COMMAND ${CMAKE_COMMAND} -E touch .timestamp.test_env - DEPENDS pysrc_copied qpid-proton-core - ) - add_custom_target(pytest_cffi ALL DEPENDS .timestamp.test_env) - endif() - # Export the pytest executable to the parent scope so it can be used by other tests set(PYTHON_TEST_EXECUTABLE "${pytest_executable}" PARENT_SCOPE) - + + add_custom_target(pytest_cffi ALL DEPENDS .timestamp.test_env) + # If we are doing coverage, then post process the python coverage data before running the coverage target if (CMAKE_BUILD_TYPE MATCHES "Coverage") add_custom_command( diff --git a/python/docs/conf.py b/python/docs/conf.py index 49c8a33c8..629ff9bee 100644 --- a/python/docs/conf.py +++ b/python/docs/conf.py @@ -13,13 +13,14 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. import os -import sys -sys.path.insert(0, os.path.abspath('../python')) + +# import sys +# sys.path.insert(0, os.path.abspath('..')) # -- Project information ----------------------------------------------------- project = 'Qpid Proton Python API' -copyright = '2019, Apache Qpid Contributors' +copyright = '2026, Apache Qpid Contributors' author = 'Apache Qpid Contributors' # The short X.Y version @@ -196,4 +197,3 @@ epub_exclude_files = ['search.html'] # -- Extension configuration ------------------------------------------------- -autodoc_mock_imports = ['cproton_ffi'] diff --git a/python/proton/_delivery.py b/python/proton/_delivery.py index 4b588b2f9..5a4a25688 100644 --- a/python/proton/_delivery.py +++ b/python/proton/_delivery.py @@ -673,7 +673,7 @@ class Delivery(Wrapper): :const:`REJECTED`, :const:`RELEASED`. :param state: State of delivery, if omitted we assume the delivery state is already set - by other means + by other means """ if state: if isinstance(state, LocalDisposition): diff --git a/python/proton/_events.py b/python/proton/_events.py index bc12f0af6..056c6d73b 100644 --- a/python/proton/_events.py +++ b/python/proton/_events.py @@ -92,6 +92,7 @@ class EventType: """ _lock = threading.Lock() _extended = TypeExtender(10000) + #: :meta private: TYPES = {} def __init__(self, name: Optional[str] = None, number: Optional[int] = None, method: Optional[str] = None) -> None: --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
