fix: improve Python executable detection and error handling in CMake #757
+82
−15
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.
Description
This pull request improves the robustness and compatibility of the CMake configuration when detecting and using the Python executable for helper commands, such as querying pybind11 and PyTorch settings. The changes ensure that the correct Python interpreter is used, provide better error handling, and maintain compatibility with legacy variables.
Details
Python Executable Handling:
RPU_PYTHON_EXECUTABLEvariable to consistently determine the Python interpreter, falling back to the legacyPYTHON_EXECUTABLEif necessary, and added a fatal error if no executable is found.Error Handling and Command Execution:
pybind11andtorchqueries) to useRPU_PYTHON_EXECUTABLEand added explicit error checking with informative fatal error messages if the commands fail or return unexpected output. [1] [2]