Skip to content

Commit

Permalink
feat: support conditions in package.xml (#86) (#87)
Browse files Browse the repository at this point in the history
* feat: Support conditions in package.xml (#86)

Signed-off-by: Tim Clephas <tim.clephas@nobleo.nl>

* Add condition to test

Signed-off-by: Tim Clephas <tim.clephas@nobleo.nl>

Signed-off-by: Tim Clephas <tim.clephas@nobleo.nl>
  • Loading branch information
Timple committed Dec 22, 2022
1 parent b602b4b commit bdcd628
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
17 changes: 9 additions & 8 deletions pre_commit_hooks/sort_package_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@
from typing import Optional
from typing import Sequence

# Closing bracket absent as conditions can be present within the xml tag
TAGS = [
"<build_depend>",
"<build_export_depend>",
"<buildtool_depend>",
"<buildtool_export_depend>",
"<exec_depend>",
"<depend>",
"<doc_depend>",
"<test_depend>",
"<build_depend",
"<build_export_depend",
"<buildtool_depend",
"<buildtool_export_depend",
"<exec_depend",
"<depend",
"<doc_depend",
"<test_depend",
]


Expand Down
2 changes: 1 addition & 1 deletion tests/test_sort_package_xml/normal.answer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<depend>aaaaa</depend>
<depend>bbbbb</depend>
<depend>ccccc</depend>
<depend>ddddd</depend>
<depend condition="$ROS_VERSION == 1">ddddd</depend>
<depend>eeeee</depend>

<test_depend>ament_lint_auto</test_depend>
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sort_package_xml/normal.input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<depend>ccccc</depend>
<depend>bbbbb</depend>
<depend>ddddd</depend>
<depend condition="$ROS_VERSION == 1">ddddd</depend>
<depend>eeeee</depend>
<depend>aaaaa</depend>

Expand Down

0 comments on commit bdcd628

Please sign in to comment.