Skip to content

Commit

Permalink
Stop using python_cmake_module. (#536)
Browse files Browse the repository at this point in the history
We really don't need it anymore, and can just use the
builtin find_package(Python3).

Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette authored Oct 3, 2024
1 parent 299574b commit b698ef5
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 41 deletions.
13 changes: 2 additions & 11 deletions test_cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@ project(test_cli)
find_package(ament_cmake_auto REQUIRED)

if(BUILD_TESTING)
# Provides PYTHON_EXECUTABLE_DEBUG
find_package(python_cmake_module REQUIRED)
find_package(PythonExtra REQUIRED)
set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}")
if(WIN32)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_DEBUG}")
endif()
endif()

# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
Expand All @@ -29,6 +19,8 @@ if(BUILD_TESTING)
find_package(ament_cmake_pytest REQUIRED)
find_package(rclcpp REQUIRED)

find_package(Python3 REQUIRED COMPONENTS Interpreter)

ament_lint_auto_find_test_dependencies()

add_executable(initial_params_rclcpp
Expand All @@ -39,7 +31,6 @@ if(BUILD_TESTING)

ament_add_pytest_test(test_params_yaml
test/test_params_yaml.py
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}"
ENV
INITIAL_PARAMS_RCLCPP=$<TARGET_FILE:initial_params_rclcpp>
INITIAL_PARAMS_RCLPY=${CMAKE_CURRENT_LIST_DIR}/test/initial_params.py
Expand Down
1 change: 0 additions & 1 deletion test_cli/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<author email="[email protected]">William Woodall</author>

<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>python_cmake_module</buildtool_depend>

<build_depend>ament_cmake</build_depend>

Expand Down
13 changes: 2 additions & 11 deletions test_cli_remapping/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@ project(test_cli_remapping)
find_package(ament_cmake_auto REQUIRED)

if(BUILD_TESTING)
# Provides PYTHON_EXECUTABLE_DEBUG
find_package(python_cmake_module REQUIRED)
find_package(PythonExtra REQUIRED)
set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}")
if(WIN32)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_DEBUG}")
endif()
endif()

# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
Expand All @@ -30,6 +20,8 @@ if(BUILD_TESTING)
find_package(rclcpp REQUIRED)
find_package(test_msgs REQUIRED)

find_package(Python3 REQUIRED COMPONENTS Interpreter)

ament_lint_auto_find_test_dependencies()

add_executable(name_maker_rclcpp
Expand All @@ -42,7 +34,6 @@ if(BUILD_TESTING)
add_launch_test(
test/test_cli_remapping.py
TARGET test_cli_remapping
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}"
ENV
NAME_MAKER_RCLCPP=$<TARGET_FILE:name_maker_rclcpp>
NAME_MAKER_RCLPY=${CMAKE_CURRENT_SOURCE_DIR}/test/name_maker.py
Expand Down
1 change: 0 additions & 1 deletion test_cli_remapping/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<author email="[email protected]">William Woodall</author>

<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>python_cmake_module</buildtool_depend>

<build_depend>ament_cmake</build_depend>

Expand Down
16 changes: 0 additions & 16 deletions test_communication/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ if(BUILD_TESTING)

find_package(launch_testing_ament_cmake REQUIRED)

# Provides PYTHON_EXECUTABLE_DEBUG
find_package(python_cmake_module REQUIRED)
find_package(PythonExtra REQUIRED)

# get the rmw implementations ahead of time
find_package(rmw_implementation_cmake REQUIRED)
get_available_rmw_implementations(rmw_implementations2)
Expand Down Expand Up @@ -241,7 +237,6 @@ if(BUILD_TESTING)
add_launch_test(
"${CMAKE_CURRENT_BINARY_DIR}/test_publisher_subscriber${suffix}_$<CONFIG>.py"
TARGET test_publisher_subscriber${suffix}
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}"
APPEND_LIBRARY_DIRS "${append_library_dirs}"
TIMEOUT ${timeout}
${SKIP_TEST})
Expand Down Expand Up @@ -283,7 +278,6 @@ if(BUILD_TESTING)
add_launch_test(
"${CMAKE_CURRENT_BINARY_DIR}/test_requester_replier${suffix}_$<CONFIG>.py"
TARGET test_requester_replier${suffix}
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}"
APPEND_LIBRARY_DIRS "${append_library_dirs}"
TIMEOUT ${timeout}
${SKIP_TEST})
Expand Down Expand Up @@ -321,7 +315,6 @@ if(BUILD_TESTING)
add_launch_test(
"${CMAKE_CURRENT_BINARY_DIR}/test_action_client_server${suffix}_$<CONFIG>.py"
TARGET test_action_client_server${suffix}
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}"
APPEND_LIBRARY_DIRS "${append_library_dirs}"
TIMEOUT ${timeout}
${SKIP_TEST})
Expand All @@ -335,7 +328,6 @@ if(BUILD_TESTING)
endmacro()

macro(configure_template _client_library1 _client_library2)
set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}")
set(_client_library1 "${_client_library1}")
set(_client_library2 "${_client_library2}")
set(TEST_PUBLISHER_RCL "${_client_library1}")
Expand All @@ -351,14 +343,6 @@ if(BUILD_TESTING)
set(suffix "__${_client_library1}__${_client_library2}")
endif()

if(_client_library1 STREQUAL "rclpy" OR _client_library2 STREQUAL "rclpy")
if(WIN32)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_DEBUG}")
endif()
endif()
endif()

if(_client_library1 STREQUAL "rclpy")
set(TEST_PUBLISHER_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/test/publisher_py.py")
set(TEST_REQUESTER_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/test/requester_py.py")
Expand Down
1 change: 0 additions & 1 deletion test_communication/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<build_depend>rosidl_default_generators</build_depend>

<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>python_cmake_module</buildtool_depend>

<exec_depend>rosidl_default_runtime</exec_depend>

Expand Down

0 comments on commit b698ef5

Please sign in to comment.