Commit 412918d1 by Henry Schreiner Committed by Henry Schreiner

feat: add entrypoint for cmake modules dir (#4258)

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

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
parent 895fc663
...@@ -144,6 +144,8 @@ with remove_output("pybind11/include", "pybind11/share"): ...@@ -144,6 +144,8 @@ with remove_output("pybind11/include", "pybind11/share"):
stdout=sys.stdout, stdout=sys.stdout,
stderr=sys.stderr, 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) txt = get_and_replace(setup_py, version=version, extra_cmd=extra_cmd)
code = compile(txt, setup_py, "exec") code = compile(txt, setup_py, "exec")
......
...@@ -160,6 +160,7 @@ def test_build_sdist(monkeypatch, tmpdir): ...@@ -160,6 +160,7 @@ def test_build_sdist(monkeypatch, tmpdir):
files |= {f"pybind11{n}" for n in local_sdist_files} files |= {f"pybind11{n}" for n in local_sdist_files}
files.add("pybind11.egg-info/entry_points.txt") files.add("pybind11.egg-info/entry_points.txt")
files.add("pybind11.egg-info/requires.txt") files.add("pybind11.egg-info/requires.txt")
files.add("pybind11/share/cmake/pybind11/__init__.py")
assert simpler == files assert simpler == files
with open(os.path.join(MAIN_DIR, "tools", "setup_main.py.in"), "rb") as f: 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): ...@@ -246,6 +247,7 @@ def tests_build_wheel(monkeypatch, tmpdir):
"dist-info/entry_points.txt", "dist-info/entry_points.txt",
"dist-info/top_level.txt", "dist-info/top_level.txt",
} }
files.add("pybind11/share/cmake/pybind11/__init__.py")
with zipfile.ZipFile(str(wheel)) as z: with zipfile.ZipFile(str(wheel)) as z:
names = z.namelist() names = z.namelist()
......
...@@ -36,6 +36,9 @@ setup( ...@@ -36,6 +36,9 @@ setup(
], ],
"pipx.run": [ "pipx.run": [
"pybind11 = pybind11.__main__:main", "pybind11 = pybind11.__main__:main",
],
"cmake.modules": [
"pybind11 = pybind11.share.cmake.pybind11",
] ]
}, },
cmdclass=cmdclass cmdclass=cmdclass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment