Skip to content

Commit ded70fe

Browse files
authored
Add pkgconf-pypi entrypoint (#5552)
- This allows `pkgconf --cflags pybind11` and similar commands to work as expected if pkgconf is installed from pypi
1 parent 79be5c8 commit ded70fe

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

setup.py

+4
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ def remove_output(*sources: str) -> Generator[None, None, None]:
144144
stderr=sys.stderr,
145145
)
146146

147+
# pkgconf-pypi needs pybind11/share/pkgconfig to be importable
148+
Path("pybind11/share/__init__.py").touch()
149+
Path("pybind11/share/pkgconfig/__init__.py").touch()
150+
147151
txt = get_and_replace(setup_py, version=version, extra_cmd=extra_cmd)
148152
code = compile(txt, setup_py, "exec")
149153
exec(code, {"SDist": SDist})

tests/extra_python_package/test_files.py

+2
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@
106106
"commands.py",
107107
"py.typed",
108108
"setup_helpers.py",
109+
"share/__init__.py",
110+
"share/pkgconfig/__init__.py",
109111
}
110112

111113
headers = main_headers | conduit_headers | detail_headers | eigen_headers | stl_headers

tools/setup_main.py.in

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ setup(
1818
"pybind11.include.pybind11.detail",
1919
"pybind11.include.pybind11.eigen",
2020
"pybind11.include.pybind11.stl",
21+
"pybind11.share",
2122
"pybind11.share.cmake.pybind11",
2223
"pybind11.share.pkgconfig",
2324
],
@@ -40,7 +41,10 @@ setup(
4041
],
4142
"pipx.run": [
4243
"pybind11 = pybind11.__main__:main",
43-
]
44+
],
45+
"pkg_config": [
46+
"pybind11 = pybind11.share.pkgconfig",
47+
],
4448
},
4549
cmdclass=cmdclass
4650
)

0 commit comments

Comments
 (0)