-
Notifications
You must be signed in to change notification settings - Fork 171
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
Set ROS_PYTHON_VERSION if unset #708
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed this a bit offline today. My main concern is that I think many devs use the python2 or python3 versions of the tools exclusively since they cannot be co-installed system-wide. Which means that it's somewhat luck-of-the-draw whether a developer is using python2 or python3 tools with a python2 or python3 workspace. If this were a tool that operated inside a ROS workspace context, this would make a lot of sense, but since rosdep is system-wide I think that this default needs a warning since it has nearly a 50-50 chance of being the wrong choice.
With ros-infrastructure/rep#207 in flight that information could be used here too. |
Codecov Report
@@ Coverage Diff @@
## master #708 +/- ##
==========================================
+ Coverage 75.82% 76.14% +0.31%
==========================================
Files 38 40 +2
Lines 3032 3106 +74
==========================================
+ Hits 2299 2365 +66
- Misses 733 741 +8
Continue to review full report at Codecov.
|
@nuclearsandwich added warning in 88816ef |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use the information from the updated REP 153.
REP 153 |
With the high probability of doing the wrong thing I wouldn't call this an enhancement. I think we should do it right when we can (when |
Warn when ROS_PYTHON_VERSION is being defaulted Signed-off-by: Shane Loretz <[email protected]>
Import from new file cache_tools.py Signed-off-by: Shane Loretz <[email protected]>
Adds a new cache directory for meta data. Stores python version for each rosdistro in the metadata cache. Signed-off-by: Shane Loretz<[email protected]> Signed-off-by: Shane Loretz <[email protected]>
88816ef
to
d72c4a3
Compare
Major changes since review
@dirk-thomas PR and PR description updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, with one question.
src/rosdep2/main.py
Outdated
@@ -391,6 +392,18 @@ def _rosdep_main(args): | |||
check_for_sources_list_init(options.sources_cache_dir) | |||
elif command not in ['fix-permissions']: | |||
setup_proxy_opener() | |||
|
|||
if 'ROS_PYTHON_VERSION' not in os.environ and options.ros_distro: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't options.ros_distro
take precedence over the environment variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
options.ros_distro
overriding ROS_PYTHON_VERSION
might be a problem for Arch Linux users. They seem to be using Python 3: https://aur.archlinux.org/packages/ros-melodic-catkin/ with melodic. If options.ros_distro
takes precedence then with #709 pip dependencies would be installed with Python 2 using Melodic on Arch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #708 (comment) why on other platforms the rosdistro configured value must have precedence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wjwwood I think this is resolved by dd4bf62 (explanation in #708 (comment)). Would you mind having another look at this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked at the added MetaDatabase
logic. I will leave that up to the maintainer(s) of rosdep
.
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Python 2 compatibility Missing imports Signed-off-by: Shane Loretz<[email protected]> Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
This allows users with a melodic workspace sourced to install dependencies for a noetic workspace, while still allowing users on community supported platforms to override the python version. Signed-off-by: Shane Loretz<[email protected]> Signed-off-by: Shane Loretz <[email protected]>
CI failure looks like a temporary network issue
|
|
||
if 'ROS_PYTHON_VERSION' not in os.environ and 'ROS_DISTRO' in os.environ: | ||
# Set python version to version used by ROS distro | ||
python_versions = MetaDatabase().get('ROS_PYTHON_VERSION') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like MetaDatabase().get('ROS_PYTHON_VERSION')
can return None
here, it's causing my CI builds to fail after I upgraded to rosdep 0.16.2: #720
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix proposed in #721
Requires ros-infrastructure/rosdistro#145
This sets
ROS_PYTHON_VERSION
if it is unset. This enables rosdep to resolve conditional dependencies usingROS_PYTHON_VERSION
before building a ROS distribution from source.If
--rosdistro
is given, it tries to use thepython_version
field from the rosdistro index. Otherwise, it uses the same version of python used to invoke rosdep as mentioned in ros-infrastructure/rep#201To try out the
python_version
attribute, update using a custom rosdistro index urlTo test, get a package using conditional dependencies and run the commands below with no ROS workspace sourced.
Before this PR
no rosdistro after this PR
melodic
noetic