From 2b78c30b54a81be23028789db2f3b278929438ec Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Tue, 20 Nov 2018 22:49:16 -0800 Subject: [PATCH] handle idl files correctly --- ros1_bridge/__init__.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ros1_bridge/__init__.py b/ros1_bridge/__init__.py index f09824a7..47925db6 100644 --- a/ros1_bridge/__init__.py +++ b/ros1_bridge/__init__.py @@ -203,10 +203,12 @@ def get_ros2_messages(): pkgs.append(package_name) resource, _ = ament_index_python.get_resource(resource_type, package_name) interfaces = resource.splitlines() - message_names = \ - [i[4:-4] for i in interfaces if i.startswith('msg/') and i.endswith('.msg')] + message_names = { + i[4:-4] + for i in interfaces + if i.startswith('msg/') and i[-4:] in ('.idl', '.msg')} - for message_name in message_names: + for message_name in sorted(message_names): msgs.append(Message(package_name, message_name, prefix_path)) # check package manifest for mapping rules package_path = os.path.join(prefix_path, 'share', package_name) @@ -254,10 +256,12 @@ def get_ros2_services(): pkgs.append(package_name) resource, _ = ament_index_python.get_resource(resource_type, package_name) interfaces = resource.splitlines() - service_names = \ - [i[4:-4] for i in interfaces if i.startswith('srv/') and i.endswith('.srv')] + service_names = { + i[4:-4] + for i in interfaces + if i.startswith('srv/') and i[-4:] in ('.idl', '.srv')} - for service_name in service_names: + for service_name in sorted(service_names): srvs.append(Message(package_name, service_name, prefix_path)) # check package manifest for mapping rules package_path = os.path.join(prefix_path, 'share', package_name)