Skip to content
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

fix: add flag for overriding classic Python search values #4195

Merged
merged 3 commits into from
Oct 23, 2022

Conversation

henryiii
Copy link
Collaborator

@henryiii henryiii commented Sep 22, 2022

Description

Should fix pybind/scikit_build_example#45.

Suggested changelog entry:

* CMake: revert overwrite behavior, now opt-in with ``PYBIND11_PYTHONLIBS_OVERRWRITE OFF``

@rwgk rwgk changed the title fix: PyPy needs to overrite broken FindPythonInterp values fix: PyPy needs to override broken FindPythonInterp values Sep 22, 2022
@henryiii
Copy link
Collaborator Author

Actually I think it's our stuff around FindPython that's breaking, not this one. Will make a new PR just in case I'm wrong and this history is useful.

@henryiii henryiii closed this Sep 22, 2022
@henryiii
Copy link
Collaborator Author

No, I take that back, this is running the old one - where are these values being set? Not by FindPythonInterp as far as I can tell...

@henryiii henryiii reopened this Sep 22, 2022
@@ -95,9 +95,24 @@ if(NOT PythonLibsNew_FIND_VERSION)
set(PythonLibsNew_FIND_VERSION "3.6")
endif()

# Save variables that get set by PythonInterp
Copy link
Collaborator

@rwgk rwgk Sep 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my viewpoint as someone not knowing much about cmake, copying the title of this PR here, ideally even with a link to this PR, would seem super helpful. Otherwise I'd give too much credit to this code looking fresh. Maybe:

# For PyPy, broken FindPythonInterp values need to be overridden (see PR #4195).
# This macro saves variables that get set by PythonInterp.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't working, so I'm going to need to address this differently anyway. I'll probably do one of two things. If I can stop these from being set at all, then the current form is fine. If not, I can introduce a toggle and then you could override all or none. Something like that. :/

Copy link
Collaborator Author

@henryiii henryiii Oct 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(So far sill have no idea who is (incorrectly) setting these values, it's not FindPythonInterp and I'm pretty sure we don't run FindPythonLibs)

@henryiii henryiii force-pushed the henryiii/fix/pypy branch 2 times, most recently from 3e31783 to c2eb69f Compare October 20, 2022 03:40
@henryiii henryiii marked this pull request as ready for review October 20, 2022 04:13
@henryiii henryiii changed the title fix: PyPy needs to override broken FindPythonInterp values fix: add flag for overriding classic Python search values Oct 20, 2022
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
@henryiii
Copy link
Collaborator Author

henryiii commented Oct 21, 2022

@rwgk or @Skylion007 What do you think? This reverts the 2.10 default change and instead makes it opt-in for now. The problem is that currently tools like scikit-build reuse the same cache dir for multiple builds, which causes the "promote to cache" that's done here to override new values with old ones on new runs. Scikit-build really should make per-interpreter cached directories; that would help, but for now, this seems like the simplest fix.

However, I'm torn - I'm also fine to say it's scikit-build's problem, and it needs include the interpreter string in the build path that gets cahced. Scikit-build-core will probably be designed this way from the start (currently, it just doesn't support caching at all - caching build directories is hard 😆). But that will make fixing scikit_build_example ugly for a bit until a proper fix lands in scikit-build. But this might motivate me. ;)

What do you think? Option a) (this PR) or option b) (declare it not broken and working as expected).

tools/FindPythonLibsNew.cmake Outdated Show resolved Hide resolved
@henryiii henryiii merged commit 4fe905d into master Oct 23, 2022
@henryiii henryiii deleted the henryiii/fix/pypy branch October 23, 2022 04:32
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Oct 23, 2022
henryiii added a commit to henryiii/pybind11 that referenced this pull request Oct 24, 2022
* fix: PyPy needs to overrite broken FindPythonInterp values

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: add flag to opt-in to new (cross-compile) behavior

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Apply suggestions from code review

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants