- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.2k
Enforce find_package(Python) #5814
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enforces the use of find_package(Python) by removing conditional checks that would skip Python finding when Python was already found. The change ensures that Python detection logic runs unconditionally rather than being bypassed when Python variables are already set.
- Removes the outer conditional wrapper around Python finding logic
- Ensures Python detection always executes regardless of existing Python_FOUND or Python3_FOUND variables
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if(NOT DEFINED Python_FIND_IMPLEMENTATIONS) | ||
| set(Python_FIND_IMPLEMENTATIONS CPython PyPy) | ||
| endif() | 
    
      
    
      Copilot
AI
    
    
    
      Sep 8, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the removal of the outer conditional check, this Python configuration will now run unconditionally. Consider whether this could overwrite existing Python_FIND_IMPLEMENTATIONS settings or if additional guards are needed to prevent reconfiguration when Python is already properly configured.
| We don't want to call FindPython if it's already been called with the right components present. Or if the user is using the old PythonInterp/Libs support. So I think the check can't be removed, but should instead check for everything that is needed, and trigger the find if everything isn't there. | 
| 
 What's the problem in doing so? Do you fear performance issues? As far a I know, cmake's find functions cache previous results. So that shouldn't be a big deal. 
 I think this is not relevant here, as the old mode is handled in  
 This would require moving the logic to figure out the required components out of the  | 
Fixes #5813