From 8d2b399782164ce6ec1d21ca546ccf87772574f2 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Thu, 12 Aug 2021 09:41:20 -0500 Subject: [PATCH] Revert "Make rosidl packages use FindPython3 instead of FindPythonInterp (#612)" This reverts commit 36ed120f43daeaab31fd9ba2bf8dfb58db05091d. --- rosidl_adapter/CMakeLists.txt | 2 +- rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake | 9 +++++---- rosidl_adapter/package.xml | 3 --- rosidl_generator_c/CMakeLists.txt | 2 +- .../cmake/rosidl_generator_c_generate_interfaces.cmake | 5 +---- rosidl_generator_c/package.xml | 1 - rosidl_generator_cpp/CMakeLists.txt | 2 +- .../cmake/rosidl_generator_cpp_generate_interfaces.cmake | 5 +---- rosidl_generator_cpp/package.xml | 1 - rosidl_typesupport_introspection_c/CMakeLists.txt | 2 +- ...typesupport_introspection_c_generate_interfaces.cmake | 5 +---- rosidl_typesupport_introspection_c/package.xml | 1 - rosidl_typesupport_introspection_cpp/CMakeLists.txt | 2 +- ...pesupport_introspection_cpp_generate_interfaces.cmake | 5 +---- rosidl_typesupport_introspection_cpp/package.xml | 1 - 15 files changed, 14 insertions(+), 32 deletions(-) diff --git a/rosidl_adapter/CMakeLists.txt b/rosidl_adapter/CMakeLists.txt index 2bea2759d..b14b5518b 100644 --- a/rosidl_adapter/CMakeLists.txt +++ b/rosidl_adapter/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.5) project(rosidl_adapter NONE) diff --git a/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake b/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake index 0d703c99e..7d2e444ef 100644 --- a/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake +++ b/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake @@ -37,13 +37,14 @@ function(rosidl_adapt_interfaces idl_var arguments_file) "arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() - find_package(ament_cmake_core REQUIRED) # for get_executable_path - find_package(Python3 REQUIRED COMPONENTS Interpreter) - get_executable_path(python_interpreter Python3::Interpreter CONFIGURE) + find_package(PythonInterp REQUIRED) + if(NOT PYTHON_EXECUTABLE) + message(FATAL_ERROR "Variable 'PYTHON_EXECUTABLE' must not be empty") + endif() set(idl_output "${CMAKE_CURRENT_BINARY_DIR}/rosidl_adapter/${ARG_TARGET}.idls") set(cmd - "${python_interpreter}" -m rosidl_adapter + "${PYTHON_EXECUTABLE}" -m rosidl_adapter --package-name ${PROJECT_NAME} --arguments-file "${arguments_file}" --output-dir "${CMAKE_CURRENT_BINARY_DIR}/rosidl_adapter/${PROJECT_NAME}" diff --git a/rosidl_adapter/package.xml b/rosidl_adapter/package.xml index e8a7cd607..8a9219031 100644 --- a/rosidl_adapter/package.xml +++ b/rosidl_adapter/package.xml @@ -11,9 +11,6 @@ Apache License 2.0 Dirk Thomas - ament_cmake_core - python3 - ament_cmake python3-empy diff --git a/rosidl_generator_c/CMakeLists.txt b/rosidl_generator_c/CMakeLists.txt index 7b9b93be1..3d61cd87b 100644 --- a/rosidl_generator_c/CMakeLists.txt +++ b/rosidl_generator_c/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.5) project(rosidl_generator_c C) diff --git a/rosidl_generator_c/cmake/rosidl_generator_c_generate_interfaces.cmake b/rosidl_generator_c/cmake/rosidl_generator_c_generate_interfaces.cmake index 8dcadc5d3..3e9b630e8 100644 --- a/rosidl_generator_c/cmake/rosidl_generator_c_generate_interfaces.cmake +++ b/rosidl_generator_c/cmake/rosidl_generator_c_generate_interfaces.cmake @@ -79,12 +79,9 @@ rosidl_write_generator_arguments( TARGET_DEPENDENCIES ${target_dependencies} ) -find_package(Python3 REQUIRED COMPONENTS Interpreter) - add_custom_command( OUTPUT ${_generated_headers} ${_generated_sources} - COMMAND Python3::Interpreter - ARGS ${rosidl_generator_c_BIN} + COMMAND ${PYTHON_EXECUTABLE} ${rosidl_generator_c_BIN} --generator-arguments-file "${generator_arguments_file}" DEPENDS ${target_dependencies} COMMENT "Generating C code for ROS interfaces" diff --git a/rosidl_generator_c/package.xml b/rosidl_generator_c/package.xml index 9a66332bb..00d3fa003 100644 --- a/rosidl_generator_c/package.xml +++ b/rosidl_generator_c/package.xml @@ -14,7 +14,6 @@ ament_cmake_ros ament_cmake_core - python3 rosidl_cmake rosidl_typesupport_interface diff --git a/rosidl_generator_cpp/CMakeLists.txt b/rosidl_generator_cpp/CMakeLists.txt index e99c75cc5..654d4c0f9 100644 --- a/rosidl_generator_cpp/CMakeLists.txt +++ b/rosidl_generator_cpp/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.5) project(rosidl_generator_cpp) diff --git a/rosidl_generator_cpp/cmake/rosidl_generator_cpp_generate_interfaces.cmake b/rosidl_generator_cpp/cmake/rosidl_generator_cpp_generate_interfaces.cmake index e5f6e4e27..c944ee340 100644 --- a/rosidl_generator_cpp/cmake/rosidl_generator_cpp_generate_interfaces.cmake +++ b/rosidl_generator_cpp/cmake/rosidl_generator_cpp_generate_interfaces.cmake @@ -74,12 +74,9 @@ rosidl_write_generator_arguments( TARGET_DEPENDENCIES ${target_dependencies} ) -find_package(Python3 REQUIRED COMPONENTS Interpreter) - add_custom_command( OUTPUT ${_generated_headers} - COMMAND Python3::Interpreter - ARGS ${rosidl_generator_cpp_BIN} + COMMAND ${PYTHON_EXECUTABLE} ${rosidl_generator_cpp_BIN} --generator-arguments-file "${generator_arguments_file}" DEPENDS ${target_dependencies} COMMENT "Generating C++ code for ROS interfaces" diff --git a/rosidl_generator_cpp/package.xml b/rosidl_generator_cpp/package.xml index 7bc4c9f74..3dadba363 100644 --- a/rosidl_generator_cpp/package.xml +++ b/rosidl_generator_cpp/package.xml @@ -12,7 +12,6 @@ ament_cmake ament_cmake_core - python3 rosidl_cmake diff --git a/rosidl_typesupport_introspection_c/CMakeLists.txt b/rosidl_typesupport_introspection_c/CMakeLists.txt index 0172ecfac..5b581ec97 100644 --- a/rosidl_typesupport_introspection_c/CMakeLists.txt +++ b/rosidl_typesupport_introspection_c/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.5) project(rosidl_typesupport_introspection_c C) diff --git a/rosidl_typesupport_introspection_c/cmake/rosidl_typesupport_introspection_c_generate_interfaces.cmake b/rosidl_typesupport_introspection_c/cmake/rosidl_typesupport_introspection_c_generate_interfaces.cmake index 0d5fd4bf7..bdd89184e 100644 --- a/rosidl_typesupport_introspection_c/cmake/rosidl_typesupport_introspection_c_generate_interfaces.cmake +++ b/rosidl_typesupport_introspection_c/cmake/rosidl_typesupport_introspection_c_generate_interfaces.cmake @@ -72,12 +72,9 @@ rosidl_write_generator_arguments( TARGET_DEPENDENCIES ${target_dependencies} ) -find_package(Python3 REQUIRED COMPONENTS Interpreter) - add_custom_command( OUTPUT ${_generated_header_files} ${_generated_source_files} - COMMAND Python3::Interpreter - ARGS ${rosidl_typesupport_introspection_c_BIN} + COMMAND ${PYTHON_EXECUTABLE} ${rosidl_typesupport_introspection_c_BIN} --generator-arguments-file "${generator_arguments_file}" DEPENDS ${target_dependencies} COMMENT "Generating C introspection for ROS interfaces" diff --git a/rosidl_typesupport_introspection_c/package.xml b/rosidl_typesupport_introspection_c/package.xml index c5f61b6b2..cb1f4f3a2 100644 --- a/rosidl_typesupport_introspection_c/package.xml +++ b/rosidl_typesupport_introspection_c/package.xml @@ -14,7 +14,6 @@ ament_cmake_ros ament_cmake - python3 rosidl_cmake rosidl_runtime_c diff --git a/rosidl_typesupport_introspection_cpp/CMakeLists.txt b/rosidl_typesupport_introspection_cpp/CMakeLists.txt index bb76b8922..c1d8b83cd 100644 --- a/rosidl_typesupport_introspection_cpp/CMakeLists.txt +++ b/rosidl_typesupport_introspection_cpp/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.5) project(rosidl_typesupport_introspection_cpp) diff --git a/rosidl_typesupport_introspection_cpp/cmake/rosidl_typesupport_introspection_cpp_generate_interfaces.cmake b/rosidl_typesupport_introspection_cpp/cmake/rosidl_typesupport_introspection_cpp_generate_interfaces.cmake index e553becf5..daeb16f77 100644 --- a/rosidl_typesupport_introspection_cpp/cmake/rosidl_typesupport_introspection_cpp_generate_interfaces.cmake +++ b/rosidl_typesupport_introspection_cpp/cmake/rosidl_typesupport_introspection_cpp_generate_interfaces.cmake @@ -72,12 +72,9 @@ rosidl_write_generator_arguments( TARGET_DEPENDENCIES ${target_dependencies} ) -find_package(Python3 REQUIRED COMPONENTS Interpreter) - add_custom_command( OUTPUT ${_generated_header_files} ${_generated_source_files} - COMMAND Python3::Interpreter - ARGS ${rosidl_typesupport_introspection_cpp_BIN} + COMMAND ${PYTHON_EXECUTABLE} ${rosidl_typesupport_introspection_cpp_BIN} --generator-arguments-file "${generator_arguments_file}" DEPENDS ${target_dependencies} COMMENT "Generating C++ introspection for ROS interfaces" diff --git a/rosidl_typesupport_introspection_cpp/package.xml b/rosidl_typesupport_introspection_cpp/package.xml index 791c4cdf2..44b7aa01c 100644 --- a/rosidl_typesupport_introspection_cpp/package.xml +++ b/rosidl_typesupport_introspection_cpp/package.xml @@ -14,7 +14,6 @@ ament_cmake_ros ament_cmake - python3 rosidl_cmake rosidl_runtime_c