Ask Your Question
1

ament_cmake_python job

asked 2020-04-20 13:21:45 -0600

aby gravatar image

updated 2020-04-20 13:23:46 -0600

I know that ament_python is for building packages using python's setup.py and (for now) users can not mix ament_cmake with ament_python in the same package.

The question is what does ament_cmake_python do? and an explanation with a use-case/example would make me happy.

Sorry, there is just some lack of information/use-cases out there about some of ament functions.

Originally asked as a comment here https://answers.ros.org/question/3495...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-04-22 11:35:36 -0600

marguedas gravatar image

updated 2020-04-23 02:47:08 -0600

While documentation is sparse, you can usually get useful information from the function/macro documentations.
Did you try looking at the content of the ament_cmake_python package? At a glance it contains only 2 macro definitions which name and docblocs are pretty explicit.

  • ament_python_install_module to install python modules
  • ament_python_install_package to install python packages

I know that [...] (for now) users can not mix ament_cmake with ament_python in the same package.

grep -rl "ament_python_install_package(" | sort -u | grep CMakeLists.txt | wc -l
41

It appears that 41 packages in the [ros2.repos](https://github.com/ros2/ros2/blob/0a62b2cd2210b06be7570c00922cd2f3d6609e31/ros2.repos) file do install python packages from ament_cmake packages. There may be restrictions or good reasons not to mix ament_cmake and python packages but it looks like in some cases it is doable and done.

Edit:

An example of package using it is rqt_plot

Are the Python packages installed here are:

  • PyPi packages and whls only
  • ros2 packages with setup.py (including the current one that the CMake is building)
  • both of the above

My understanding from reading the docblock is that it installs the python package you point to and any sub-package in that same directory (sub-directories containing an __init__.py). It does not require any setup.py, just the presence of an __init__.py file So I expect it to install noting outside that directory, no other ROS 2 packages and no Pypi packages, only recursive subpackages

edit flag offensive delete link more

Comments

I looked at the Github page before but I was not able to read such CMake file at my current early stage. These are questions to clarify the answer above.

  1. Where to run this grep command? in which of the ros2 repos?
  2. Are the Python packages installed here are:
    1. PyPi packages and whls only
    2. ros2 packages with setup.py (including the current one that the CMake is building)
    3. both of the above
aby gravatar image aby  ( 2020-04-22 17:33:00 -0600 )edit

I edited the answer above to add a link to the ros2.repos file and answer the follow-up question

marguedas gravatar image marguedas  ( 2020-04-23 02:47:40 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-04-20 13:21:45 -0600

Seen: 370 times

Last updated: Apr 23 '20