Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export PYTHONPATH when sourcing the workspace #271

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions colcon.pkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Configuration file for colcon (https://colcon.readthedocs.io).
{
"hooks": ["share/ignition-math6/setup.sh"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to gazebosim/gazebo-classic#3066, I think we should be careful about adding files specific to certain tools, and instead try to find solutions that apply to most setups.

With that in mind, we should at a minimum add instructions for users to source the setup file on their own when using debs or plain cmake.

}
12 changes: 12 additions & 0 deletions src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ if (PYTHONLIBS_FOUND)
set(IGN_PYTHON_INSTALL_PATH ${IGN_LIB_INSTALL_DIR}/python)
endif()

# TODO(ahcorde): Use ign-cmake to include hooks
# Refer to this issue: https://github.com/ignitionrobotics/ign-cmake/issues/185
configure_file(
"setup.sh.in"
"${CMAKE_CURRENT_BINARY_DIR}/share/setup.sh" @ONLY
)

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/share/setup.sh
DESTINATION share/${PROJECT_NAME}
)

set(IGN_PYTHON_INSTALL_PATH "${IGN_PYTHON_INSTALL_PATH}/ignition")
install(TARGETS ${SWIG_PY_LIB} DESTINATION ${IGN_PYTHON_INSTALL_PATH})
install(FILES ${CMAKE_BINARY_DIR}/lib/python/math.py DESTINATION ${IGN_PYTHON_INSTALL_PATH})
Expand Down
3 changes: 3 additions & 0 deletions src/python/setup.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# generated from ignition-math/setup.sh.in

export PYTHONPATH=@CMAKE_INSTALL_PREFIX@/@IGN_PYTHON_INSTALL_PATH@:$PYTHONPATH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being set to install/lib/python/swig, should it be install/lib/python?