How does catkin_install_python works in CMakelists.txt?

asked 2022-04-03 11:03:48 -0500

pyros gravatar image

I have recently learnt about the catkin_install_python in CMakelists.txt, where you can specify your python programs and ROS will take care to make them executable and append the appropriate shebang to the script.

I just wonder how it works. I have experimented with creating a simple Python program that simply prints “hello world” (not executable, no shebang). Then I added that script in CMakelists.txt under catkin_install_python. Then I ran catkin_make. Now the script can be run using rosrun my_pkg If I now change the content of the script I don't have to run catkin_make again, it just works! So, how does ROS work under the hood when it comes to this? Initially, I thought it creates some soft link to the file, but how does it append the shebang then?

Thank you!

edit retag flag offensive close merge delete