This is an archive of the discontinued LLVM Phabricator instance.

[lldb/CMake] Autodetect Python dependency
ClosedPublic

Authored by JDevlieghere on Jan 2 2020, 1:48 PM.

Details

Summary

Python was the last remaining "optional" dependency for LLDB. This moves the code to find Python into FindPythonInterpAndLibs using the same principles as FindCursesAndPanel.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

JDevlieghere created this revision.Jan 2 2020, 1:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 2 2020, 1:48 PM
Herald added a subscriber: mgorny. · View Herald Transcript

It's nice to consolidate the logic into one place. I think you will probably need to make an appropriate change on the buildbot side as well (if you haven't done that already).

Where is FindPythonInterpAndLibs being included?

It's nice to consolidate the logic into one place. I think you will probably need to make an appropriate change on the buildbot side as well (if you haven't done that already).

Do you mean forcing LLDB_ENABLE_PYTHON to on so that it fails in case the logic changes and Python isn't found?

Where is FindPythonInterpAndLibs being included?

It's included from the add_optional_dependency macro.

Do you mean forcing LLDB_ENABLE_PYTHON to on so that it fails in case the logic changes and Python isn't found?

Yes, something like that. It looks like the previous expected behavior was that python was implicitly a required dependency (unless you explicitly disabled it or were building for android/ios). Making it an optional dependency means that the buildbots should probably explicitly say that they want to enable python. You could probably not change buildbot invocations, but that means that if a buildbot fails to find python then we won't know until something goes wrong (e.g. A test fails locally on some setup that passed buildbots because buildbots weren't running python tests).

JDevlieghere added a comment.EditedJan 2 2020, 2:41 PM

Do you mean forcing LLDB_ENABLE_PYTHON to on so that it fails in case the logic changes and Python isn't found?

Yes, something like that. It looks like the previous expected behavior was that python was implicitly a required dependency (unless you explicitly disabled it or were building for android/ios). Making it an optional dependency means that the buildbots should probably explicitly say that they want to enable python. You could probably not change buildbot invocations, but that means that if a buildbot fails to find python then we won't know until something goes wrong (e.g. A test fails locally on some setup that passed buildbots because buildbots weren't running python tests).

Yup, I've updated the config in 9a3d9b7f

mgorny added inline comments.Jan 2 2020, 10:57 PM
lldb/cmake/modules/FindPythonInterpAndLibs.cmake
2

Typo.

labath accepted this revision.Jan 6 2020, 6:39 AM

Looks fine to me. Thanks for tackling this.

This revision is now accepted and ready to land.Jan 6 2020, 6:39 AM
This revision was automatically updated to reflect the committed changes.