Skip to content

Commit

Permalink
Added colcon hook for setting the PYTHONPATH environment variable (ro…
Browse files Browse the repository at this point in the history
  • Loading branch information
marip8 authored Jun 27, 2023
1 parent 41fde3c commit 90a872f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion colcon.pkg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"hooks": ["share/reach/hook/ament_prefix_path.dsv", "share/reach/hook/ros_package_path.dsv"]
"hooks": ["share/reach/hook/ament_prefix_path.dsv", "share/reach/hook/ros_package_path.dsv", "share/reach/hook/python_path.dsv"]
}
6 changes: 6 additions & 0 deletions src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ set_target_properties(
OUTPUT_NAME ${PROJECT_NAME})
target_cxx_version(${PROJECT_NAME}_python PUBLIC VERSION 14)

# Add a hook for colcon to add the Python library directory to the PYTHONPATH environment variable
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv
"prepend-non-duplicate;PYTHONPATH;lib/python3/dist-packages")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv
DESTINATION share/${PROJECT_NAME}/hook)

list(
APPEND
TARGETS
Expand Down

0 comments on commit 90a872f

Please sign in to comment.