From 7fcc891ada2f03696a25647846d7aff12401462a Mon Sep 17 00:00:00 2001 From: John Wason Date: Mon, 11 May 2026 21:01:41 -0400 Subject: [PATCH] Fix colcon Python hooks on Windows --- tesseract_python/CMakeLists.txt | 8 +++++++- tesseract_python/colcon.pkg | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tesseract_python/CMakeLists.txt b/tesseract_python/CMakeLists.txt index 90289362a..687024785 100644 --- a/tesseract_python/CMakeLists.txt +++ b/tesseract_python/CMakeLists.txt @@ -258,7 +258,13 @@ if (${PYTHON_VERSION_MAJOR} LESS 3) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv "prepend-non-duplicate;PYTHONPATH;lib/python2.7/dist-packages") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv DESTINATION share/${PROJECT_NAME}/hook) else() - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv "prepend-non-duplicate;PYTHONPATH;lib/python3/dist-packages") + if (WIN32) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv "prepend-non-duplicate;PYTHONPATH;lib/site-packages") + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/tesseract_python_dll_path.dsv "prepend-non-duplicate;TESSERACT_PYTHON_DLL_PATH;bin") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/tesseract_python_dll_path.dsv DESTINATION share/${PROJECT_NAME}/hook) + else() + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv "prepend-non-duplicate;PYTHONPATH;lib/python3/dist-packages") + endif() install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv DESTINATION share/${PROJECT_NAME}/hook) endif() diff --git a/tesseract_python/colcon.pkg b/tesseract_python/colcon.pkg index 00c48f3e1..2a7112818 100644 --- a/tesseract_python/colcon.pkg +++ b/tesseract_python/colcon.pkg @@ -1,3 +1,3 @@ { - "hooks": ["share/tesseract_python/hook/ament_prefix_path.dsv", "share/tesseract_python/hook/python_path.dsv"] + "hooks": ["share/tesseract_python/hook/ament_prefix_path.dsv", "share/tesseract_python/hook/python_path.dsv", "share/tesseract_python/hook/tesseract_python_dll_path.dsv"] }