Skip to content

Commit

Permalink
use ament_python_install_package when package is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
knorth55 committed Oct 26, 2022
1 parent 20bcc4c commit 264961e
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,23 @@ rosidl_write_generator_arguments(
)

if(NOT rosidl_generate_interfaces_SKIP_INSTALL)
ament_python_install_package(${PROJECT_NAME} PACKAGE_DIR "${_output_path}")
if(${PROJECT_NAME} IN_LIST AMENT_CMAKE_PYTHON_INSTALL_INSTALLED_NAMES)
ament_python_install_module("${_output_path}/__init__.py"
DESTINATION_SUFFIX "${PROJECT_NAME}"
)

# TODO(esteve): replace this with ament_python_install_module and allow a list
# of modules to be passed instead of iterating over _generated_py_files
# See https://github.com/ros2/rosidl/issues/89
foreach(_generated_py_dir ${_generated_py_dirs})
install(DIRECTORY "${_output_path}/${_generated_py_dir}/"
DESTINATION "${PYTHON_INSTALL_DIR}/${PROJECT_NAME}/${_generated_py_dir}"
PATTERN "*.py"
)
endforeach()
else()
ament_python_install_package(${PROJECT_NAME} PACKAGE_DIR "${_output_path}")
endif()
endif()

set(_target_suffix "__py")
Expand Down

0 comments on commit 264961e

Please sign in to comment.