Skip to content

Commit b698ef5

Browse files
authoredOct 3, 2024··
Stop using python_cmake_module. (#536)
We really don't need it anymore, and can just use the builtin find_package(Python3). Signed-off-by: Chris Lalancette <[email protected]>
1 parent 299574b commit b698ef5

File tree

6 files changed

+4
-41
lines changed

6 files changed

+4
-41
lines changed
 

‎test_cli/CMakeLists.txt

+2-11
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@ project(test_cli)
55
find_package(ament_cmake_auto REQUIRED)
66

77
if(BUILD_TESTING)
8-
# Provides PYTHON_EXECUTABLE_DEBUG
9-
find_package(python_cmake_module REQUIRED)
10-
find_package(PythonExtra REQUIRED)
11-
set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}")
12-
if(WIN32)
13-
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
14-
set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_DEBUG}")
15-
endif()
16-
endif()
17-
188
# Default to C++17
199
if(NOT CMAKE_CXX_STANDARD)
2010
set(CMAKE_CXX_STANDARD 17)
@@ -29,6 +19,8 @@ if(BUILD_TESTING)
2919
find_package(ament_cmake_pytest REQUIRED)
3020
find_package(rclcpp REQUIRED)
3121

22+
find_package(Python3 REQUIRED COMPONENTS Interpreter)
23+
3224
ament_lint_auto_find_test_dependencies()
3325

3426
add_executable(initial_params_rclcpp
@@ -39,7 +31,6 @@ if(BUILD_TESTING)
3931

4032
ament_add_pytest_test(test_params_yaml
4133
test/test_params_yaml.py
42-
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}"
4334
ENV
4435
INITIAL_PARAMS_RCLCPP=$<TARGET_FILE:initial_params_rclcpp>
4536
INITIAL_PARAMS_RCLPY=${CMAKE_CURRENT_LIST_DIR}/test/initial_params.py

‎test_cli/package.xml

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
<author email="william@openrobotics.org">William Woodall</author>
1818

1919
<buildtool_depend>ament_cmake_auto</buildtool_depend>
20-
<buildtool_depend>python_cmake_module</buildtool_depend>
2120

2221
<build_depend>ament_cmake</build_depend>
2322

‎test_cli_remapping/CMakeLists.txt

+2-11
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@ project(test_cli_remapping)
55
find_package(ament_cmake_auto REQUIRED)
66

77
if(BUILD_TESTING)
8-
# Provides PYTHON_EXECUTABLE_DEBUG
9-
find_package(python_cmake_module REQUIRED)
10-
find_package(PythonExtra REQUIRED)
11-
set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}")
12-
if(WIN32)
13-
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
14-
set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_DEBUG}")
15-
endif()
16-
endif()
17-
188
# Default to C++17
199
if(NOT CMAKE_CXX_STANDARD)
2010
set(CMAKE_CXX_STANDARD 17)
@@ -30,6 +20,8 @@ if(BUILD_TESTING)
3020
find_package(rclcpp REQUIRED)
3121
find_package(test_msgs REQUIRED)
3222

23+
find_package(Python3 REQUIRED COMPONENTS Interpreter)
24+
3325
ament_lint_auto_find_test_dependencies()
3426

3527
add_executable(name_maker_rclcpp
@@ -42,7 +34,6 @@ if(BUILD_TESTING)
4234
add_launch_test(
4335
test/test_cli_remapping.py
4436
TARGET test_cli_remapping
45-
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}"
4637
ENV
4738
NAME_MAKER_RCLCPP=$<TARGET_FILE:name_maker_rclcpp>
4839
NAME_MAKER_RCLPY=${CMAKE_CURRENT_SOURCE_DIR}/test/name_maker.py

‎test_cli_remapping/package.xml

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
<author email="william@openrobotics.org">William Woodall</author>
1818

1919
<buildtool_depend>ament_cmake_auto</buildtool_depend>
20-
<buildtool_depend>python_cmake_module</buildtool_depend>
2120

2221
<build_depend>ament_cmake</build_depend>
2322

‎test_communication/CMakeLists.txt

-16
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ if(BUILD_TESTING)
7575

7676
find_package(launch_testing_ament_cmake REQUIRED)
7777

78-
# Provides PYTHON_EXECUTABLE_DEBUG
79-
find_package(python_cmake_module REQUIRED)
80-
find_package(PythonExtra REQUIRED)
81-
8278
# get the rmw implementations ahead of time
8379
find_package(rmw_implementation_cmake REQUIRED)
8480
get_available_rmw_implementations(rmw_implementations2)
@@ -241,7 +237,6 @@ if(BUILD_TESTING)
241237
add_launch_test(
242238
"${CMAKE_CURRENT_BINARY_DIR}/test_publisher_subscriber${suffix}_$<CONFIG>.py"
243239
TARGET test_publisher_subscriber${suffix}
244-
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}"
245240
APPEND_LIBRARY_DIRS "${append_library_dirs}"
246241
TIMEOUT ${timeout}
247242
${SKIP_TEST})
@@ -283,7 +278,6 @@ if(BUILD_TESTING)
283278
add_launch_test(
284279
"${CMAKE_CURRENT_BINARY_DIR}/test_requester_replier${suffix}_$<CONFIG>.py"
285280
TARGET test_requester_replier${suffix}
286-
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}"
287281
APPEND_LIBRARY_DIRS "${append_library_dirs}"
288282
TIMEOUT ${timeout}
289283
${SKIP_TEST})
@@ -321,7 +315,6 @@ if(BUILD_TESTING)
321315
add_launch_test(
322316
"${CMAKE_CURRENT_BINARY_DIR}/test_action_client_server${suffix}_$<CONFIG>.py"
323317
TARGET test_action_client_server${suffix}
324-
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}"
325318
APPEND_LIBRARY_DIRS "${append_library_dirs}"
326319
TIMEOUT ${timeout}
327320
${SKIP_TEST})
@@ -335,7 +328,6 @@ if(BUILD_TESTING)
335328
endmacro()
336329

337330
macro(configure_template _client_library1 _client_library2)
338-
set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}")
339331
set(_client_library1 "${_client_library1}")
340332
set(_client_library2 "${_client_library2}")
341333
set(TEST_PUBLISHER_RCL "${_client_library1}")
@@ -351,14 +343,6 @@ if(BUILD_TESTING)
351343
set(suffix "__${_client_library1}__${_client_library2}")
352344
endif()
353345

354-
if(_client_library1 STREQUAL "rclpy" OR _client_library2 STREQUAL "rclpy")
355-
if(WIN32)
356-
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
357-
set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_DEBUG}")
358-
endif()
359-
endif()
360-
endif()
361-
362346
if(_client_library1 STREQUAL "rclpy")
363347
set(TEST_PUBLISHER_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/test/publisher_py.py")
364348
set(TEST_REQUESTER_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/test/requester_py.py")

‎test_communication/package.xml

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
<build_depend>rosidl_default_generators</build_depend>
2323

2424
<buildtool_depend>ament_cmake_auto</buildtool_depend>
25-
<buildtool_depend>python_cmake_module</buildtool_depend>
2625

2726
<exec_depend>rosidl_default_runtime</exec_depend>
2827

0 commit comments

Comments
 (0)
Please sign in to comment.