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

Don't wrap modules #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
55 changes: 36 additions & 19 deletions ament_cmake_virtualenv/cmake/ament_generate_virtualenv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,14 @@ function(ament_generate_virtualenv)
)


# Override the ament_python_install_module macro to wrap modules
find_program(wrap_module_BIN NAMES "wrap_module"
PATHS "${CMAKE_INSTALL_PREFIX}/../ament_virtualenv/bin/")
if(NOT wrap_module_BIN)
message(FATAL_ERROR "could not find program 'wrap_module'")
endif()
macro(ament_python_install_module)
# Override the ament_python_install_module macro to wrap modules
find_program(wrap_module_BIN NAMES "wrap_module"
PATHS "${CMAKE_INSTALL_PREFIX}/../ament_virtualenv/bin/")
if(NOT wrap_module_BIN)
message(FATAL_ERROR "could not find program 'wrap_module'")
endif()

_ament_cmake_python_register_environment_hook()
_ament_cmake_python_install_module(${ARGN})
get_filename_component(module_path ${ARGN} NAME)
Expand All @@ -148,22 +149,38 @@ COMMAND ${wrap_module_BIN} --module-path ${module_path} --venv-install-dir ${${P
)
endmacro()

# Override the ament_python_install_package macro to wrap packages
find_program(wrap_package_BIN NAMES "wrap_package"
PATHS "${CMAKE_INSTALL_PREFIX}/../ament_virtualenv/bin/")
if(NOT wrap_package_BIN)
message(FATAL_ERROR "could not find program 'wrap_package'")
endif()
macro(ament_python_install_package)
# Override the ament_python_install_package macro to wrap packages
find_program(wrap_package_BIN NAMES "wrap_package"
PATHS "${CMAKE_INSTALL_PREFIX}/../ament_virtualenv/bin/")
if(NOT wrap_package_BIN)
message(FATAL_ERROR "could not find program 'wrap_package'")
endif()

_ament_cmake_python_register_environment_hook()
_ament_cmake_python_install_package(${ARGN})

set(options "")
set(oneValueArgs "")
set(multiValueArgs SCRIPTS)
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

# TODO: remove, this is to debug
get_cmake_property(_variableNames VARIABLES)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
Comment on lines +168 to +172

Choose a reason for hiding this comment

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

Would it be worth leaving and comment it out, so we can use it to debug later?


set(package_dir "${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_DIR}/${ARGN}")
# message(
# WARNING "[ament_cmake_virtualenv]: ament_python_install_package override for ${package_dir} to ${${PROJECT_NAME}_VENV_INSTALL_DIR}"
# )
install(
CODE "execute_process(\
COMMAND ${wrap_package_BIN} --package-dir ${package_dir} --venv-install-dir ${${PROJECT_NAME}_VENV_INSTALL_DIR})"
)

if(ARG_SCRIPTS_DIR)
#message(
# INFO "[ament_cmake_virtualenv]: ament_python_install_package override for ${package_dir} to ${${PROJECT_NAME}_VENV_INSTALL_DIR}"
#)
install(
CODE "execute_process(\
COMMAND ${wrap_package_BIN} --package-dir ${package_dir} --venv-install-dir ${${PROJECT_NAME}_VENV_INSTALL_DIR})"
)
endif()
endmacro()
endfunction()
Loading