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

Do I need to add <build_depend> entries for pure Python packages?

asked 2019-08-20 10:27:10 -0600

moooeeeep gravatar image

updated 2019-08-20 10:57:29 -0600

In the package.xml file we specify dependencies that we need at compile time for our package, e.g., as <build_depend>rospy</build_depend>.

As my Python package contains only Python code, that is not really compiled, do I actually have dependencies at compile time?

Or would it be enough to specify runtime dependencies for my example node?

Example (derived from this one):

<?xml version="1.0"?>
<package format="2">
  <name>beginner_tutorials</name>
  <version>0.1.0</version>
  <description>The beginner_tutorials package</description>

  <maintainer email="you@yourdomain.tld">Your Name</maintainer>
  <license>BSD</license>
  <url type="website">http://wiki.ros.org/beginner_tutorials</url>
  <author email="you@yourdomain.tld">Jane Doe</author>

  <buildtool_depend>catkin</buildtool_depend>

  <exec_depend>rospy</exec_depend>
  <exec_depend>std_msgs</exec_depend>

</package>

With a CMakeLists.txt, that I think, should go along these lines:

cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)

find_package(catkin REQUIRED COMPONENTS
  rospy
  std_msgs
)

catkin_package()

install(PROGRAMS
  scripts/listener.py
  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
edit retag flag offensive close merge delete

Comments

Please share your CMakeLists.txt which will allow to determine if the specified dependencies are sufficient. On a first look it should be good as is.

Dirk Thomas gravatar image Dirk Thomas  ( 2019-08-20 10:37:05 -0600 )edit

@DirkThomas I made up a CMakeLists.txt, but I'm again not sure, whether I actually need to define the REQUIRED COMPONENTS for catkin here...

moooeeeep gravatar image moooeeeep  ( 2019-08-20 10:45:06 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-08-20 10:56:08 -0600

Dirk Thomas gravatar image

You don't need the REQUIRED COMPONENTS rospy std_msgs in the find_package(catkin).

With those removed the stated dependencies (exec_depend on rospy and std_msgs without the need for build_depend) are sufficient.

Side note: you want to use catkin_install_python(...) instead of install(...) for your Python scripts since it will make sure to rewrite the shebang line of the script to the selected Python interpreter. The custom function takes the same arguments so you only need to change the function name.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-08-20 10:27:10 -0600

Seen: 390 times

Last updated: Aug 20 '19