Skip to content

Commit 412918d

Browse files
committed
feat: add entrypoint for cmake modules dir (#4258)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
1 parent 895fc66 commit 412918d

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ def remove_output(*sources: str) -> Iterator[None]:
144144
stdout=sys.stdout,
145145
stderr=sys.stderr,
146146
)
147+
if not global_sdist:
148+
Path("pybind11/share/cmake/pybind11/__init__.py").touch()
147149

148150
txt = get_and_replace(setup_py, version=version, extra_cmd=extra_cmd)
149151
code = compile(txt, setup_py, "exec")

tests/extra_python_package/test_files.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def test_build_sdist(monkeypatch, tmpdir):
160160
files |= {f"pybind11{n}" for n in local_sdist_files}
161161
files.add("pybind11.egg-info/entry_points.txt")
162162
files.add("pybind11.egg-info/requires.txt")
163+
files.add("pybind11/share/cmake/pybind11/__init__.py")
163164
assert simpler == files
164165

165166
with open(os.path.join(MAIN_DIR, "tools", "setup_main.py.in"), "rb") as f:
@@ -246,6 +247,7 @@ def tests_build_wheel(monkeypatch, tmpdir):
246247
"dist-info/entry_points.txt",
247248
"dist-info/top_level.txt",
248249
}
250+
files.add("pybind11/share/cmake/pybind11/__init__.py")
249251

250252
with zipfile.ZipFile(str(wheel)) as z:
251253
names = z.namelist()

tools/setup_main.py.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ setup(
3636
],
3737
"pipx.run": [
3838
"pybind11 = pybind11.__main__:main",
39+
],
40+
"cmake.modules": [
41+
"pybind11 = pybind11.share.cmake.pybind11",
3942
]
4043
},
4144
cmdclass=cmdclass

0 commit comments

Comments
 (0)