ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to write a package.xml compatible with both of melodic and noetic when it depends python-<library name> package.

asked 2020-10-08 10:00:13 -0500

sktometometo gravatar image

How to write a package.xml when the catkin package depends on a library which has a different rosdep entry in focal from in melodic? e.g. python-pyaudio and python3-pyaudio?

I am writing a package.xml for my catkin package which uses pyaudio library. So I want to add pyaudio to package.xml as a dependency. But the rosdep entry for pyaudio library for system python is different in melodic and noetic. ( python-pyaudio for melodic and python3-pyaudio for noetic )

If package.xml contains both of them, its test in travis fails because python-pyaudio package is not released in ubuntu focal.

Is there any way to write a package.xml compatible with both of melodic and noetic?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-10-08 13:55:39 -0500

sloretz gravatar image

Use format="3" and conditional dependencies. See this section from the Transitioning To Python 3 guide on the ROS wiki

<exec_depend condition="$ROS_PYTHON_VERSION == 2">python-pyaudio</exec_depend>
<exec_depend condition="$ROS_PYTHON_VERSION == 3">python3-pyaudio</exec_depend>
edit flag offensive delete link more


It works fine! Thank you.

sktometometo gravatar image sktometometo  ( 2020-10-08 20:26:09 -0500 )edit

That's it! With format="2" it complains The "exec_depend" tag must not have..., but with format="3" everything works out well. Thanks!

F1iX gravatar image F1iX  ( 2021-10-22 12:51:52 -0500 )edit

Question Tools

1 follower


Asked: 2020-10-08 10:00:13 -0500

Seen: 498 times

Last updated: Oct 08 '20