Robotics StackExchange | Archived questions

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

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?

Asked by sktometometo on 2020-10-08 10:00:13 UTC

Comments

Answers

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>

Asked by sloretz on 2020-10-08 13:55:39 UTC

Comments

It works fine! Thank you.

Asked by sktometometo on 2020-10-08 20:26:09 UTC

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

Asked by F1iX on 2021-10-22 12:51:52 UTC