Skip to content

Commit 264961e

Browse files
committed
use ament_python_install_package when package is not installed
1 parent 20bcc4c commit 264961e

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake

+17-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,23 @@ rosidl_write_generator_arguments(
121121
)
122122

123123
if(NOT rosidl_generate_interfaces_SKIP_INSTALL)
124-
ament_python_install_package(${PROJECT_NAME} PACKAGE_DIR "${_output_path}")
124+
if(${PROJECT_NAME} IN_LIST AMENT_CMAKE_PYTHON_INSTALL_INSTALLED_NAMES)
125+
ament_python_install_module("${_output_path}/__init__.py"
126+
DESTINATION_SUFFIX "${PROJECT_NAME}"
127+
)
128+
129+
# TODO(esteve): replace this with ament_python_install_module and allow a list
130+
# of modules to be passed instead of iterating over _generated_py_files
131+
# See https://github.com/ros2/rosidl/issues/89
132+
foreach(_generated_py_dir ${_generated_py_dirs})
133+
install(DIRECTORY "${_output_path}/${_generated_py_dir}/"
134+
DESTINATION "${PYTHON_INSTALL_DIR}/${PROJECT_NAME}/${_generated_py_dir}"
135+
PATTERN "*.py"
136+
)
137+
endforeach()
138+
else()
139+
ament_python_install_package(${PROJECT_NAME} PACKAGE_DIR "${_output_path}")
140+
endif()
125141
endif()
126142

127143
set(_target_suffix "__py")

0 commit comments

Comments
 (0)