Skip to content

Conversation

@henryiii
Copy link
Collaborator

@henryiii henryiii commented Oct 21, 2022

Going to back out on #4258 before we release, we can add it more carefully later, I don't want to get the name and suggested usage wrong.

@henryiii
Copy link
Collaborator Author

henryiii commented Oct 21, 2022

For a little background: there are two ways to specify where this is; one is by building a list of CMAKE_PREFIX_PATH=dir1;dir2, and the other is by setting a specific path, pybind11_ROOT=dir1 in CMake 3.13+. The latter is better unless you have to support older CMake's. It's also easier to not override or intentionally override. So I'm thinking:

# Better
module_dirs = importlib.metadata.entry_points(group="cmake.root")
packages = {ep.name:importlib.resources.files(ep.load()) for ep in module_dirs}
cmake_args = [f"-{k}_ROOT={v}" for k,v in packages]

# Old CMakes
module_dirs = importlib.metadata.entry_points(group="cmake.root")
dirs = (importlib.resources.files(ep.load()) for ep in module_dirs)
paths_str = ";".join(str(p) for p in dirs)
cmake_arg = [f"-DCMAKE_PREFIX_PATH={paths_str}"]

Same structure as before, but we need to pin down the name. cmake.module would be for modules, cmake.prefix could stay open just in case we want prefixes, and I'm currently experimenting with adding site-packages to cmake_prefix. cmake.root matches the suggested variable name, but it's not very descriptive.

@henryiii henryiii merged commit 91cfb77 into master Oct 21, 2022
@henryiii henryiii deleted the revert-4258-henryiii/feat/entrypoint branch October 21, 2022 21:25
henryiii added a commit to henryiii/pybind11 that referenced this pull request Oct 21, 2022
* Revert "feat: add entrypoint for cmake modules dir (pybind#4258)"

This reverts commit 1d4a65e.

* docs: revert changelog mention too
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