Skip to content

Commit 1ab6159

Browse files
authored
Support Python 3.8 importlib.metadata, declare dependency (#229)
The importlib_metadata package is a backport of the importlib.metadata module from Python 3.8. We should prefer the one coming from Python itself, and fall back to the backport if Python doesn't provide it. Since this could mean an additional dependency on some platforms, we should also declare that dependency. Signed-off-by: Scott K Logan <[email protected]>
1 parent ab52d30 commit 1ab6159

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

launch_ros/launch_ros/actions/node.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
from typing import Tuple # noqa: F401
2626
from typing import Union
2727

28-
import importlib_metadata
28+
try:
29+
import importlib.metadata as importlib_metadata
30+
except ModuleNotFoundError:
31+
import importlib_metadata
2932

3033
from launch.action import Action
3134
from launch.actions import ExecuteProcess

launch_ros/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<depend>lifecycle_msgs</depend>
1717
<depend>osrf_pycommon</depend>
1818
<depend>rclpy</depend>
19+
<depend>python3-importlib-metadata</depend>
1920
<depend>python3-yaml</depend>
2021
<depend>composition_interfaces</depend>
2122

0 commit comments

Comments
 (0)