-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Noetic] create relay scripts in devel space to ensure correct Python shebang #1044
Conversation
Please see my comment in the ros_comm ticket. I would consider both of the following anti-goals:
That leaves the option to relax the non-unique check of The case where this would not be sufficient is if a script is only used for testing but is not being installed. For those scripts no CMake is invoked and therefore we can't generate the relay script automatically. Either the package needs to be touched to generate a relay script in the devel space for this or the (launch) test needs to be updated to consider |
Roger. I'll try to reply to the parts relevant to installing python scripts here, and respond to parts about test scripts in the ros_comm ticket.
Assuming the |
The change to |
I think it affects catkin in that this PR should be released only to distros that the |
1db7ef5
to
9a33f43
Compare
@dirk-thomas With ros/ros#233 open, I think both are ready to be reviewed together. |
9a33f43
to
269a6aa
Compare
The overall patch LGTM. Since this will need to target a to-be-created In parallel I will try to get other code cleanup changes landed to avoid diverging these two branches. |
1d9ccbb
to
47538df
Compare
I split this PR into #1054 (generic changes) and rebased this one. Once #1054 is merged and |
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
47538df
to
5a6c2d8
Compare
PEP 394 recommends python scripts have their shebangs re-written to a specific version of python when they're installed. The CMake macro
catkin_install_python()
does this; however, when the devel space is sourced the script is executed from thesrc
space which does not have rewritten shebangs. This PR creates a relay script in the devel space to make sure the right version of python is invoked. It reuses an existing relay script created bycatkin
for scripts passed in thescripts
argument tosetup()
in asetup.py
.I think this is appropriate, but I would not release this into
kinetic
because it changes the behavior ofrosrun
if the script is executable in thesrc
space. For example, urdfdom_py installs a scriptdisplay_urdf
which is executable and has a shebang#!/usr/bin/env python
. When there is also a relay script in thedevel
space thenrosrun
complains about there being multiple options.A solution is to remove the executable permissions from
display_urdf
insrc
space, which I think is fine for Noetic, but it would mean changing downstream code in an already released distro if this PR was released intokinetic
ormelodic
.Another solution would be to make
rosrun
just take the first option, which is what roslaunch does, but that seems like a large change for a stable distro likekinetic
.This is similar to ros/ros_comm#1830, but it does not solve that particular issue since tests shouldn't be installed.