Skip to content

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

Merged
henryiii merged 3 commits into
masterfrom
henryiii/fix/pypy
Oct 23, 2022
Merged

fix: add flag for overriding classic Python search values#4195
henryiii merged 3 commits into
masterfrom
henryiii/fix/pypy

Conversation

@henryiii

@henryiiihenryiii commented Sep 22, 2022

Copy link
Copy Markdown
Collaborator

Description

Should fixpybind/scikit_build_example#45.

Suggested changelog entry:

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

@rwgkrwgk changed the title fix: PyPy needs to overrite broken FindPythonInterp valuesfix: PyPy needs to override broken FindPythonInterp valuesSep 22, 2022
@henryiii

Copy link
Copy Markdown
CollaboratorAuthor

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

Copy link
Copy Markdown
CollaboratorAuthor

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...

@henryiiihenryiii reopened this Sep 22, 2022
Comment threadtools/FindPythonLibsNew.cmake Outdated
set(PythonLibsNew_FIND_VERSION "3.6")
endif()

# Save variables that get set by PythonInterp

@rwgkrwgkSep 23, 2022

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
CollaboratorAuthor

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. :/

@henryiiihenryiiiOct 4, 2022

Copy link
Copy Markdown
CollaboratorAuthor

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
henryiiiforce-pushed the henryiii/fix/pypy branch 2 times, most recently from 3e31783 to c2eb69fCompareOctober 20, 2022 03:40
@henryiii
henryiii marked this pull request as ready for review October 20, 2022 04:13
@henryiiihenryiii changed the title fix: PyPy needs to override broken FindPythonInterp valuesfix: add flag for overriding classic Python search valuesOct 20, 2022
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
@henryiii

henryiii commented Oct 21, 2022

Copy link
Copy Markdown
CollaboratorAuthor

@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).

Comment threadtools/FindPythonLibsNew.cmake Outdated
Comment threadtools/FindPythonLibsNew.cmake Outdated
@henryiii
henryiii merged commit 4fe905d into masterOct 23, 2022
@henryiii
henryiii deleted the henryiii/fix/pypy branch October 23, 2022 04:32
@github-actionsgithub-actionsBot 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>
@henryiiihenryiii removed the needs changelog Possibly needs a changelog entry label Oct 31, 2022
@rwgkrwgk mentioned this pull request Feb 11, 2023
Sign up for freeto 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

@henryiii@rwgk@Skylion007