ros2 / rosidl_python

rosidl support for Python
Apache License 2.0
20 stars 45 forks source link

Missing dependency on `ament_cmake_flake8`? #198

Closed 130s closed 1 year ago

130s commented 1 year ago

Issue report

Required Info:

Steps to reproduce issue

Buildfarm output https://build.ros2.org/job/Rpr__smach__ubuntu_jammy_amd64/2/console for https://github.com/ros/executive_smach/pull/112 where a dependency on ament_cmake_flake8 is removed in a downstream package (smach_msgs) so that none of the packages in the repo in the PR depends on nor call ament_cmake_flake8 any more.

(I haven't figured out exactly what command was called when the reported error occured. My guess is either some sort of `rosidl` command was called, or `colcon build` ``` : 17:32:59 -- Found PythonExtra: .so 17:32:59 CMake Error at /opt/ros/rolling/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:335 (find_package): 17:32:59 By not providing "Findament_cmake_flake8.cmake" in CMAKE_MODULE_PATH this 17:32:59 project has asked CMake to find a package configuration file provided by 17:32:59 "ament_cmake_flake8", but CMake did not find one. 17:32:59 17:32:59 Could not find a package configuration file provided by 17:32:59 "ament_cmake_flake8" with any of the following names: 17:32:59 17:32:59 ament_cmake_flake8Config.cmake 17:32:59 ament_cmake_flake8-config.cmake 17:32:59 17:32:59 Add the installation prefix of "ament_cmake_flake8" to CMAKE_PREFIX_PATH or 17:32:59 set "ament_cmake_flake8_DIR" to a directory containing one of the above 17:32:59 files. If "ament_cmake_flake8" provides a separate development package or ```

Expected behavior

In a downstream interface package, no error during cmake regarding ament_cmake_flake8Config.cmake / ament_cmake_flake8-config.cmake should be seen while building rosidl package, even when the downstream interface package does NOT explicitly depend on ament_cmake_flake8.

Actual behavior

The error posted in "Steps to reproduce issue" section occurs.

130s commented 1 year ago

In ver 0.19.0, ament_cmake_flake8 IS find_package-ed when ADD_LINTER_TESTS is enabled, which is true in the case of https://github.com/ros/executive_smach/pull/112 so failure occurring in that pkg makes sense.

https://github.com/ros2/rosidl_python/blob/0.19.0/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake#L335