-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Python detection macro in cmake fails to detect highest installed version #24252
Comments
Macro for python detection was taking old version installed for compatability (needed by the zephyr SDK for gdb). Make the macro detect latest version installed instead. Fixes zephyrproject-rtos#24252. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
I think no. This backport is not necessary. And in fact FindPythonInterp is deprecated since CMake 3.12: https://cmake.org/cmake/help/v3.12/module/FindPythonInterp.html We should be using this instead: https://cmake.org/cmake/help/v3.13/module/FindPython3.html#module:FindPython3 |
@nashif already looking at this for another reason, see this: #23981 (comment) We might be able to completely remove Zephyr local copy for finding |
Seems this bug has been re-introduced #11103 by this commit a5eb70f 😞
going to ensure #11103 is fixed again, and check the following issues are still fixed when switching to CMake built-in Python search. |
@nashif actually, the current design is made so it should choose the version first in path, which was even an issue raised by you, #11857 In my opinion, CMake should choose:
|
Fixes: zephyrproject-rtos#23922, zephyrproject-rtos#24252, zephyrproject-rtos#11103 This commit switches to use the find_package(Python3) introduced with CMake 3.12. This removes the need for a Zephyr backport of Python detection module. The search order for Python3 is following CMake search order and can be controlled through CMake flags (See CMake documentation). Default it will use the Python version found in PATH. If multiple Python3 versions are found in PATH, the newest version will be selected (Can be controlled using `Python3_FIND_STRATEGY`) Using find_package(Python3) also ensures Python2.7 will never be selected, issue zephyrproject-rtos#11103, which was re-introduced in Zephyr. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes: #23922, #24252, #11103 This commit switches to use the find_package(Python3) introduced with CMake 3.12. This removes the need for a Zephyr backport of Python detection module. The search order for Python3 is following CMake search order and can be controlled through CMake flags (See CMake documentation). Default it will use the Python version found in PATH. If multiple Python3 versions are found in PATH, the newest version will be selected (Can be controlled using `Python3_FIND_STRATEGY`) Using find_package(Python3) also ensures Python2.7 will never be selected, issue #11103, which was re-introduced in Zephyr. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes: zephyrproject-rtos#23922, zephyrproject-rtos#24252, zephyrproject-rtos#11103 This commit switches to use the find_package(Python3) introduced with CMake 3.12. This removes the need for a Zephyr backport of Python detection module. The search order for Python3 is following CMake search order and can be controlled through CMake flags (See CMake documentation). Default it will use the Python version found in PATH. If multiple Python3 versions are found in PATH, the newest version will be selected (Can be controlled using `Python3_FIND_STRATEGY`) Using find_package(Python3) also ensures Python2.7 will never be selected, issue zephyrproject-rtos#11103, which was re-introduced in Zephyr. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes: zephyrproject-rtos#23922, zephyrproject-rtos#24252, zephyrproject-rtos#11103 This commit switches to use the find_package(Python3) introduced with CMake 3.12. This removes the need for a Zephyr backport of Python detection module. The search order for Python3 is following CMake search order and can be controlled through CMake flags (See CMake documentation). Default it will use the Python version found in PATH. If multiple Python3 versions are found in PATH, the newest version will be selected (Can be controlled using `Python3_FIND_STRATEGY`) Using find_package(Python3) also ensures Python2.7 will never be selected, issue zephyrproject-rtos#11103, which was re-introduced in Zephyr. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Describe the bug
Python detection fails to detect highest installed version, instead it find a compatibility and older version installed.
To Reproduce
However, I have 3.7.x
Expected behavior
cmake should find the highest version installed.
Impact
Failure to build
Additional context
Looking at cmake/python.cmake
That text seems to be outdated and needs to be updated. we already use 3.13, is all of this still needed?
If I make this change:
I get the expected behavior:
The text was updated successfully, but these errors were encountered: