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

Prefer setuptools with Python 3 #1048

Merged
merged 3 commits into from
Jan 22, 2020

Conversation

sloretz
Copy link
Contributor

@sloretz sloretz commented Jan 17, 2020

This is a follow up to ros/genmsg#90 (comment)

Currently catkin requires distutils and optionally supports setuptools; however, distutils for Python 3 requires a dependency on python3-distutils in Ubuntu Focal and Debian Buster. This PR makes catkin prefer setuptools and optionally support distutils when using Python 3.

  • catkin itself uses setuptools in its own setup.py
  • When interrogating another package's setup.py, don't fail if distutils.core can't be imported
  • When using Python 3, add a buildtool_export_depend on setuptools since something like it must be available downstream
  • Update documentation to use setuptools instead of distutils.core.

With this PR I think the effect on Python 2 ROS distros is python-setuptools would be installed where it wasn't before, but no downstream changes are required. The effect on Noetic is downstream packages depending on catkin either need to depend on python3-distutils or use setuptools instead.

Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
@sloretz sloretz self-assigned this Jan 17, 2020
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
@sloretz
Copy link
Contributor Author

sloretz commented Jan 17, 2020

CI failure on Noetic appears to be due to CMake warning unrelated to this PR: http://build.ros.org/job/Npr__catkin__ubuntu_focal_amd64/4/warnings2Result/new/

@mikepurvis
Copy link
Member

This change is causing a bit of chaos for us as the install directory has changed from lib/python3/dist-packages/catkin to lib/python3/dist-packages/catkin-0.8.0-py3.5.egg, with an lib/python3/dist-packages/easy-install.pth file generated that adds the egg path to sys.path on interpreter startup.

Part of the reason this is problematic is because we build in isolation with custom post-build merging, but even in a more conventional build scenario, there's a conflict over this file as it could be provided by multiple packages with varying contents.

Switching to setuptools makes sense, but I think we should be passing it the --single-version-externally-managed flag.

FYI @tspicer01

@ros-discourse
Copy link

This pull request has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/ros-1-and-python-3-10s-deprecation-of-distutils-core/29834/15

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

5 participants