Skip to content
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

Catkin plugin: Use in-snap python instead of OS-provided. #232

Merged

Conversation

kyrofa
Copy link
Contributor

@kyrofa kyrofa commented Jan 14, 2016

This works pre-Xenial since python2 is provided on the image. However, it's been removed in Xenial which uncovered this bug. The fix simply rewrites all /usr/bin/python shebangs to use /usr/bin/env python, and also fixes up 10.ros.sh to use python from the path instead of /usr/bin/python.

LP: #1533297

@kyrofa kyrofa force-pushed the bugfix/1533297/catkin_run_on_rolling branch 2 times, most recently from a5d426f to bf88521 Compare January 14, 2016 23:09
pattern = re.compile(r'#!.*python')
for root, directories, files in os.walk(self.rosdir):
for fileName in files:
with open(os.path.join(root, fileName), 'r+') as f:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would extract this into a method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which part exactly-- the walking bit?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first, the code inside the second for.
Then, maybe the two fors too, but this might be too much.

@kyrofa kyrofa force-pushed the bugfix/1533297/catkin_run_on_rolling branch from bf88521 to 4689cc4 Compare January 14, 2016 23:47
@sergiusens
Copy link
Collaborator

'RosCorePlugin' object has no attribute 'rosdir'

@sergiusens
Copy link
Collaborator

Once that is fixed you will run into:

OSError: Parts 'catkin-tutorials' and 'roscore' have the following file paths in common which have different contents:
opt/ros/indigo/bin/catkin_find
opt/ros/indigo/bin/catkin_init_workspace
opt/ros/indigo/bin/catkin_make
opt/ros/indigo/bin/catkin_make_isolated
opt/ros/indigo/bin/catkin_package_version
opt/ros/indigo/bin/catkin_prepare_release
opt/ros/indigo/bin/catkin_test_results
opt/ros/indigo/bin/catkin_topological_order
opt/ros/indigo/bin/rosconsole
opt/ros/indigo/bin/rosgraph
opt/ros/indigo/etc/catkin/profile.d/10.ros.sh
opt/ros/indigo/lib/python2.7/dist-packages/genmsg/gentools.py
opt/ros/indigo/lib/python2.7/dist-packages/roslib/gentools.py
opt/ros/indigo/lib/python2.7/dist-packages/roslib/launcher.py
opt/ros/indigo/lib/python2.7/dist-packages/roslib/manifest.py
opt/ros/indigo/lib/python2.7/dist-packages/roslib/manifestlib.py
opt/ros/indigo/lib/python2.7/dist-packages/roslib/stack_manifest.py
opt/ros/indigo/lib/python2.7/dist-packages/roslib/stacks.py
opt/ros/indigo/lib/roslib/gendeps

Due to the global regexing (I guess)

@kyrofa kyrofa force-pushed the bugfix/1533297/catkin_run_on_rolling branch from 4689cc4 to d090cf7 Compare January 15, 2016 12:25
@kyrofa
Copy link
Contributor Author

kyrofa commented Jan 15, 2016

@sergiusens oops, knew I did that refactor too quickly. And no, the reason roscore has that clean step as well is to avoid just that.

This works pre-Xenial since python2 is provided on the image.
However, it's been removed in Xenial which uncovered this
bug. The fix simply rewrites all /usr/bin/python shebangs to
use /usr/bin/env python, and also fixes up 10.ros.sh to use
python from the path instead of /usr/bin/python.

LP: #1533297

Signed-off-by: Kyle Fazzari <kyle@canonical.com>
@kyrofa kyrofa force-pushed the bugfix/1533297/catkin_run_on_rolling branch from d090cf7 to 31b745f Compare January 15, 2016 13:07
sergiusens added a commit that referenced this pull request Jan 15, 2016
Catkin plugin: Use in-snap python instead of OS-provided.
@sergiusens sergiusens merged commit fe9ca74 into canonical:master Jan 15, 2016
@kyrofa kyrofa deleted the bugfix/1533297/catkin_run_on_rolling branch January 21, 2016 14:23
kalikiana pushed a commit to kalikiana/snapcraft that referenced this pull request Apr 6, 2017
…n_on_rolling

Catkin plugin: Use in-snap python instead of OS-provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants