Skip to content

Commit d6338e8

Browse files
committed
Fix cmake formatting
1 parent d6bc1d6 commit d6338e8

File tree

1 file changed

+27
-24
lines changed

1 file changed

+27
-24
lines changed

bitbots_team_communication/bitbots_team_communication/CMakeLists.txt

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ find_package(ament_cmake_python REQUIRED)
66
find_package(bitbots_docs REQUIRED)
77
find_package(Protobuf REQUIRED)
88

9-
add_custom_target(${PROJECT_NAME}_generate_proto ALL)
9+
add_custom_target(
10+
${PROJECT_NAME}_generate_proto ALL
11+
COMMENT "Generating protobuf python interface including stubs")
12+
13+
set(PROTO_FILES
14+
bitbots_team_communication/RobocupProtocol/robocup_extension.proto)
1015

1116
add_custom_command(
1217
TARGET ${PROJECT_NAME}_generate_proto
13-
COMMAND protoc
14-
--pyi_out ${CMAKE_SOURCE_DIR}/bitbots_team_communication/
15-
--python_out ${CMAKE_SOURCE_DIR}/bitbots_team_communication/
16-
--proto_path ${CMAKE_SOURCE_DIR}/bitbots_team_communication/RobocupProtocol
17-
${CMAKE_SOURCE_DIR}/bitbots_team_communication/RobocupProtocol/robocup_extension.proto
18+
COMMAND
19+
protoc --pyi_out ${CMAKE_SOURCE_DIR}/bitbots_team_communication/
20+
--python_out ${CMAKE_SOURCE_DIR}/bitbots_team_communication/ --proto_path
21+
${CMAKE_SOURCE_DIR}/bitbots_team_communication/RobocupProtocol
22+
${CMAKE_SOURCE_DIR}/${PROTO_FILES}
1823
COMMENT "Generating protobuf python interface including stubs")
1924

2025
enable_bitbots_docs()
@@ -48,33 +53,31 @@ if(BUILD_TESTING)
4853

4954
find_package(ament_cmake_mypy REQUIRED)
5055

56+
# The following logic for manually filtering out the files can be removed if
57+
# https://github.com/ament/ament_lint/pull/516 is merged and released in our
58+
# ROS distro
5159

52-
# The following logic for manually filtering out the files can be removed if
53-
# https://github.com/ament/ament_lint/pull/516 is merged and released in our ROS distro
54-
5560
# Collect all .py and .pyi files
5661
file(GLOB_RECURSE PY_FILES "${CMAKE_CURRENT_LIST_DIR}/**/*.py")
5762
file(GLOB_RECURSE PYI_FILES "${CMAKE_CURRENT_LIST_DIR}/**/*.pyi")
5863

5964
# Filter out .py files if a corresponding .pyi file exists
6065
foreach(py_file IN LISTS PY_FILES)
61-
# Get the directory and basename (without extension)
62-
get_filename_component(py_dir "${py_file}" DIRECTORY)
63-
get_filename_component(py_basename "${py_file}" NAME_WE)
64-
65-
# Construct the corresponding .pyi file path
66-
set(pyi_file "${py_dir}/${py_basename}.pyi")
67-
68-
# If a corresponding .pyi file exists, remove the .py file from the list
69-
if(EXISTS "${pyi_file}")
70-
list(REMOVE_ITEM PY_FILES "${py_file}")
71-
endif()
66+
# Get the directory and basename (without extension)
67+
get_filename_component(py_dir "${py_file}" DIRECTORY)
68+
get_filename_component(py_basename "${py_file}" NAME_WE)
69+
70+
# Construct the corresponding .pyi file path
71+
set(PYI_FILE "${py_dir}/${py_basename}.pyi")
72+
73+
# If a corresponding .pyi file exists, remove the .py file from the list
74+
if(EXISTS "${PYI_FILE}")
75+
list(REMOVE_ITEM PY_FILES "${py_file}")
76+
endif()
7277
endforeach()
7378

74-
ament_mypy(
75-
CONFIG_FILE "${CMAKE_CURRENT_LIST_DIR}/mypy.ini"
76-
${PY_FILES} ${PYI_FILES}
77-
)
79+
ament_mypy(CONFIG_FILE "${CMAKE_CURRENT_LIST_DIR}/mypy.ini" ${PY_FILES}
80+
${PYI_FILES})
7881
endif()
7982

8083
ament_package()

0 commit comments

Comments
 (0)