# catkin install scripts with symlink

When a package has scripts (either in src/ or in scripts/) catkin_make install can copy those scripts into a install location so that they can be rosrun able. (This is done at the bottom of http://wiki.ros.org/rospy_tutorials/T... )

Is there an equivalent to python setup.py develop or pip install --editable that allows the original script to be edited and immediately run, without needing to do catkin_make install? This would require, for example, not copying the script but making a symlink.

edit retag close merge delete

Sort by » oldest newest most voted

This will sounds 'strange', but just don't run catkin_make install. Catkin only installs things when you ask it to. In a non-install run, it will compile things that need to be compiled (ie: C++, other languages), copy the output to the devel space, but Python modules and scripts are actually (almost) untouched.

It then places the path to the package containing the Python module(s) and script(s) in the src space on the PYTHONPATH and ROS_PACKAGE_PATH and after you source \$CATKIN_WS/devel/setup.bash you should be able to run everything. The install space is actually not needed for that.

You end up with a situation that is analogous to setup.py develop (analogous, not identical): just edit the files in your srcspace and after having run catkin_make the first time, you don't need to do it again.

Unless you add or remove packages, or msg, service or action definitions, or any other part of packages that require code generation or building of some form.

Edit:

If I have a catkin_install_python, then I can rosrun mypkg myscript, otherwise myscript isn't available to rosrun.

I don't know about catkin_install_python, but rosrun will only show and start executable files. I've had this problem when forgetting to make my scripts executable.

more

Thanks for your answer. I suppose then I am missing something in CMakeLists.txt. If I have a catkin_install_python, then I can rosrun mypkg myscript, otherwise myscript isn't available to rosrun. Also I think I need catkin_make install for an unrelated reason.

( 2018-04-07 16:12:03 -0600 )edit

If you must run catkin_make install, then you can't exploit the devel space as I wrote above unfortunately (or, not immediately: workspace overlaying could be used to work around this).

( 2018-04-08 03:19:47 -0600 )edit