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

Use FindPython3 explicitly instead of FindPythonInterp implicitly #345

Merged
merged 1 commit into from
Aug 6, 2021

Conversation

sloretz
Copy link
Contributor

@sloretz sloretz commented Aug 5, 2021

Rcutils implicitly depends on FindPythonInterp being called by ament_cmake_core. I noticed it will fail to build while testing a branch to use FindPython3 in ament_cmake. This PR makes the python interpreter dependency explicit, and uses FindPython3 instead of FindPythonInterp

Related to ros2/python_cmake_module#6
Blocks ament/ament_cmake#355

Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
@sloretz sloretz self-assigned this Aug 5, 2021
@sloretz
Copy link
Contributor Author

sloretz commented Aug 5, 2021

CI (build: --packages-up-to rcutils test: --packages-select rcutils)

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@@ -16,6 +16,8 @@ include(CheckLibraryExists)
find_package(ament_cmake_python REQUIRED)
find_package(ament_cmake_ros REQUIRED)

find_package(Python3 REQUIRED COMPONENTS Interpreter)
Copy link
Contributor

Choose a reason for hiding this comment

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

So this is great that we are making this an explicit dependency in CMakeLists.txt.

I wonder if we should also make python3 an explicit build_depend/buildtool_depend in the package.xml. It will always implicitly get pulled in because of the buildtool_depend on python3-empy, but it is a little weird to find_package something that doesn't have an entry in the package.xml. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's reasonable to add python3 as the buildtool_depend. This is getting that for free from ament_cmake, so adding it to the package.xml fits the theme of being explicit. It seems unlikely to have an impact in the future as I imagine ament_cmake will always depend on Python.

it is a little weird to find_package something that doesn't have an entry in the package.xml

The FindPython3 module is provided by CMake, so this is find_packaging() is a module from CMake itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, that's a fair point. In that case, I don't feel strongly about whether we have a package.xml depends on python or not. I'm going to go ahead and approve this, and let you decide whether to add the depends.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll leave the package.xml as is for expediency.

@sloretz sloretz merged commit 2f0eed3 into master Aug 6, 2021
@delete-merged-branch delete-merged-branch bot deleted the use_FindPython3_rcutils branch August 6, 2021 16:13
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