Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a work in progress, intending to solve a problem with newer python requirements which don't allow user or system level dependencies.
I'm having multiple issues with nuttx that I'm not sure how to solve yet.
#23073
Solved Problem
This correctly implements a Python Virtual Environment which allows for local installation of all python dependencies. It updates CMakeLists.txt references to use the FindPython3 cmake module, which can correctly identify a virtual environment if it is sourced. In the root level CMakeLists.txt, it will mimic activation of the virtual environment via setting the $VIRTUAL_ENV environment variable.
Unsolved Problems
Something in this merge request seems to be conflicting with the customized CMakeFiles.txt for our NuttX fork, and will result in build errors for any target built on nuttx. It seems as though certain libraries are not being built, and it's not clear to me what about the python virtual environment is causing this.
Additionally, the libuavcan submodule is using the old FindPythonInterp module which will not recognize virtual environments. When I looked at the git repo for libuavcan, it says that it is deprecated and should be replaced with https://github.com/dronecan/libcanard, so it probably means they won't be accepting any pull requests to fix that. I'm not sure what problems might arise from this, as I don't think I can even get to the point in the build process where that might be tested.
Some miscellaneous notes
I chose to use a hidden directory (
.venv/
) for the virtual environment, as this directory is often just extra noise in filesystem explorer apps. If necessary, we can use the more conventional and unhiddenvenv/
.If testing out locally, please use the
Tools/setup/ubuntu.sh
orTools/setup/macos.sh
scripts, as that is what creates the virtual environment.