Skip to content

Commit

Permalink
feat: add entrypoint for cmake modules dir (pybind#4258)
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>

Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored Oct 20, 2022
1 parent c385468 commit 1d4a65e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def remove_output(*sources: str) -> Iterator[None]:
stdout=sys.stdout,
stderr=sys.stderr,
)
if not global_sdist:
Path("pybind11/share/cmake/pybind11/__init__.py").touch()

txt = get_and_replace(setup_py, version=version, extra_cmd=extra_cmd)
code = compile(txt, setup_py, "exec")
Expand Down
2 changes: 2 additions & 0 deletions tests/extra_python_package/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def test_build_sdist(monkeypatch, tmpdir):
files |= {f"pybind11{n}" for n in local_sdist_files}
files.add("pybind11.egg-info/entry_points.txt")
files.add("pybind11.egg-info/requires.txt")
files.add("pybind11/share/cmake/pybind11/__init__.py")
assert simpler == files

with open(os.path.join(MAIN_DIR, "tools", "setup_main.py.in"), "rb") as f:
Expand Down Expand Up @@ -252,6 +253,7 @@ def tests_build_wheel(monkeypatch, tmpdir):
"dist-info/entry_points.txt",
"dist-info/top_level.txt",
}
files.add("pybind11/share/cmake/pybind11/__init__.py")

with zipfile.ZipFile(str(wheel)) as z:
names = z.namelist()
Expand Down
3 changes: 3 additions & 0 deletions tools/setup_main.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ setup(
],
"pipx.run": [
"pybind11 = pybind11.__main__:main",
],
"cmake.modules": [
"pybind11 = pybind11.share.cmake.pybind11",
]
},
cmdclass=cmdclass
Expand Down

0 comments on commit 1d4a65e

Please sign in to comment.