File tree Expand file tree Collapse file tree 3 files changed +23
-13
lines changed Expand file tree Collapse file tree 3 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -60,19 +60,22 @@ install(TARGETS behaviortree_py example
6060# ##############################################################################
6161# ################## Generate and install Python stubs #########################
6262# ##############################################################################
63- add_custom_command (
64- TARGET behaviortree_py
65- POST_BUILD
66- COMMAND stubgen --output $<TARGET_FILE_DIR:behaviortree_py> -p behaviortree_py
67- -v --verbose
68- WORKING_DIRECTORY $<TARGET_FILE_DIR:behaviortree_py>
69- USES_TERMINAL )
63+ find_program (STUBGEN_EXECUTABLE stubgen)
64+ if (STUBGEN_EXECUTABLE)
65+ add_custom_command (
66+ TARGET behaviortree_py
67+ POST_BUILD
68+ COMMAND stubgen --output $<TARGET_FILE_DIR:behaviortree_py> -p
69+ behaviortree_py -v --verbose
70+ WORKING_DIRECTORY $<TARGET_FILE_DIR:behaviortree_py>
71+ USES_TERMINAL )
7072
71- install (
72- FILES
73- $<TARGET_FILE_DIR:behaviortree_py>/$<TARGET_FILE_BASE_NAME:behaviortree_py>.pyi
74- COMPONENT python
75- DESTINATION ${PYTHON_INSTALL_DIR} /$<TARGET_FILE_BASE_NAME:behaviortree_py>)
73+ install (
74+ FILES
75+ $<TARGET_FILE_DIR:behaviortree_py>/$<TARGET_FILE_BASE_NAME:behaviortree_py>.pyi
76+ COMPONENT python
77+ DESTINATION ${PYTHON_INSTALL_DIR} /$<TARGET_FILE_BASE_NAME:behaviortree_py>)
78+ endif ()
7679
7780ament_export_targets(${PROJECT_NAME} Targets HAS_LIBRARY_TARGET)
7881ament_export_dependencies(behaviortree_cpp pybind11_vendor fmt py_binding_tools
Original file line number Diff line number Diff line change @@ -40,6 +40,14 @@ bt.load_type_converters(
4040...
4141```
4242
43+ ## Stubs generation
44+
45+ If you want the stubs to be generated, you need to install the package ` mypy ` :
46+
47+ ``` bash
48+ sudo apt install mypy
49+ ```
50+
4351## Limitations
4452
4553- Only ` register_simple_action ` , ` register_simple_condition ` , and ` register_simple_decorator ` are currently supported.
Original file line number Diff line number Diff line change 1111
1212 <depend >behaviortree_cpp</depend >
1313 <depend >py_binding_tools</depend >
14- <depend >python3-mypy</depend >
1514 <depend >fmt</depend >
1615
1716 <export >
You can’t perform that action at this time.
0 commit comments