File tree 3 files changed +23
-13
lines changed
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
60
60
# ##############################################################################
61
61
# ################## Generate and install Python stubs #########################
62
62
# ##############################################################################
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 )
70
72
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 ()
76
79
77
80
ament_export_targets(${PROJECT_NAME} Targets HAS_LIBRARY_TARGET)
78
81
ament_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(
40
40
...
41
41
```
42
42
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
+
43
51
## Limitations
44
52
45
53
- Only ` register_simple_action ` , ` register_simple_condition ` , and ` register_simple_decorator ` are currently supported.
Original file line number Diff line number Diff line change 11
11
12
12
<depend >behaviortree_cpp</depend >
13
13
<depend >py_binding_tools</depend >
14
- <depend >python3-mypy</depend >
15
14
<depend >fmt</depend >
16
15
17
16
<export >
You can’t perform that action at this time.
0 commit comments