1 from __future__
import annotations
14 DIR = os.path.abspath(os.path.dirname(__file__))
15 MAIN_DIR = os.path.dirname(os.path.dirname(DIR))
18 prefix=${{pcfiledir}}/../../
19 includedir=${{prefix}}/include
22 Description: Seamless operability between C++11 and Python
24 Cflags: -I${{includedir}}
29 "include/pybind11/attr.h",
30 "include/pybind11/buffer_info.h",
31 "include/pybind11/cast.h",
32 "include/pybind11/chrono.h",
33 "include/pybind11/common.h",
34 "include/pybind11/complex.h",
35 "include/pybind11/eigen.h",
36 "include/pybind11/embed.h",
37 "include/pybind11/eval.h",
38 "include/pybind11/functional.h",
39 "include/pybind11/gil.h",
40 "include/pybind11/gil_safe_call_once.h",
41 "include/pybind11/iostream.h",
42 "include/pybind11/numpy.h",
43 "include/pybind11/operators.h",
44 "include/pybind11/options.h",
45 "include/pybind11/pybind11.h",
46 "include/pybind11/pytypes.h",
47 "include/pybind11/stl.h",
48 "include/pybind11/stl_bind.h",
49 "include/pybind11/type_caster_pyobject_ptr.h",
50 "include/pybind11/typing.h",
54 "include/pybind11/detail/class.h",
55 "include/pybind11/detail/common.h",
56 "include/pybind11/detail/cpp_conduit.h",
57 "include/pybind11/detail/descr.h",
58 "include/pybind11/detail/init.h",
59 "include/pybind11/detail/internals.h",
60 "include/pybind11/detail/type_caster_base.h",
61 "include/pybind11/detail/typeid.h",
62 "include/pybind11/detail/value_and_holder.h",
63 "include/pybind11/detail/exception_translation.h",
67 "include/pybind11/eigen/common.h",
68 "include/pybind11/eigen/matrix.h",
69 "include/pybind11/eigen/tensor.h",
73 "include/pybind11/stl/filesystem.h",
77 "include/pybind11/eigen/common.h",
78 "include/pybind11/eigen/matrix.h",
79 "include/pybind11/eigen/tensor.h",
83 "include/pybind11/stl/filesystem.h",
87 "share/cmake/pybind11/FindPythonLibsNew.cmake",
88 "share/cmake/pybind11/pybind11Common.cmake",
89 "share/cmake/pybind11/pybind11Config.cmake",
90 "share/cmake/pybind11/pybind11ConfigVersion.cmake",
91 "share/cmake/pybind11/pybind11GuessPythonExtSuffix.cmake",
92 "share/cmake/pybind11/pybind11NewTools.cmake",
93 "share/cmake/pybind11/pybind11Targets.cmake",
94 "share/cmake/pybind11/pybind11Tools.cmake",
98 "share/pkgconfig/pybind11.pc",
110 headers = main_headers | detail_headers | eigen_headers | stl_headers
111 src_files = headers | cmake_files | pkgconfig_files
112 all_files = src_files | py_files
118 "pybind11/include/pybind11",
119 "pybind11/include/pybind11/detail",
120 "pybind11/include/pybind11/eigen",
121 "pybind11/include/pybind11/stl",
123 "pybind11/share/cmake",
124 "pybind11/share/cmake/pybind11",
125 "pybind11/share/pkgconfig",
136 local_sdist_files = {
138 ".egg-info/PKG-INFO",
139 ".egg-info/SOURCES.txt",
140 ".egg-info/dependency_links.txt",
141 ".egg-info/not-zip-safe",
142 ".egg-info/top_level.txt",
147 start = tar.getnames()[0] +
"/"
148 inner_file = tar.extractfile(tar.getmember(f
"{start}{name}"))
150 with contextlib.closing(inner_file)
as f:
155 return value.replace(os.linesep.encode(
"utf-8"), b
"\n")
159 monkeypatch.chdir(MAIN_DIR)
162 [sys.executable,
"-m",
"build",
"--sdist", f
"--outdir={tmpdir}"], check=
True
165 (sdist,) = tmpdir.visit(
"*.tar.gz")
167 with tarfile.open(
str(sdist),
"r:gz")
as tar:
168 start = tar.getnames()[0] +
"/"
169 version = start[9:-1]
170 simpler = {n.split(
"/", 1)[-1]
for n
in tar.getnames()[1:]}
174 pkgconfig =
read_tz_file(tar,
"pybind11/share/pkgconfig/pybind11.pc")
176 tar,
"pybind11/share/cmake/pybind11/pybind11Config.cmake"
180 'set(pybind11_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")'
181 in cmake_cfg.decode(
"utf-8")
184 files = {f
"pybind11/{n}" for n
in all_files}
186 files |= {f
"pybind11{n}" for n
in local_sdist_files}
187 files.add(
"pybind11.egg-info/entry_points.txt")
188 files.add(
"pybind11.egg-info/requires.txt")
189 assert simpler == files
191 with open(os.path.join(MAIN_DIR,
"tools",
"setup_main.py.in"),
"rb")
as f:
193 string.Template(f.read().
decode(
"utf-8"))
194 .substitute(version=version, extra_cmd=
"")
197 assert setup_py == contents
199 with open(os.path.join(MAIN_DIR,
"tools",
"pyproject.toml"),
"rb")
as f:
201 assert pyproject_toml == contents
203 simple_version =
".".join(version.split(
".")[:3])
204 pkgconfig_expected = PKGCONFIG.format(VERSION=simple_version).
encode(
"utf-8")
209 monkeypatch.chdir(MAIN_DIR)
210 monkeypatch.setenv(
"PYBIND11_GLOBAL_SDIST",
"1")
212 [sys.executable,
"-m",
"build",
"--sdist",
"--outdir",
str(tmpdir)], check=
True
215 (sdist,) = tmpdir.visit(
"*.tar.gz")
217 with tarfile.open(
str(sdist),
"r:gz")
as tar:
218 start = tar.getnames()[0] +
"/"
219 version = start[16:-1]
220 simpler = {n.split(
"/", 1)[-1]
for n
in tar.getnames()[1:]}
224 pkgconfig =
read_tz_file(tar,
"pybind11/share/pkgconfig/pybind11.pc")
226 tar,
"pybind11/share/cmake/pybind11/pybind11Config.cmake"
230 'set(pybind11_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")'
231 in cmake_cfg.decode(
"utf-8")
234 files = {f
"pybind11/{n}" for n
in all_files}
236 files |= {f
"pybind11_global{n}" for n
in local_sdist_files}
237 assert simpler == files
239 with open(os.path.join(MAIN_DIR,
"tools",
"setup_global.py.in"),
"rb")
as f:
241 string.Template(f.read().
decode())
242 .substitute(version=version, extra_cmd=
"")
245 assert setup_py == contents
247 with open(os.path.join(MAIN_DIR,
"tools",
"pyproject.toml"),
"rb")
as f:
249 assert pyproject_toml == contents
251 simple_version =
".".join(version.split(
".")[:3])
252 pkgconfig_expected = PKGCONFIG.format(VERSION=simple_version).
encode(
"utf-8")
257 monkeypatch.chdir(MAIN_DIR)
260 [sys.executable,
"-m",
"pip",
"wheel",
".",
"-w",
str(tmpdir)], check=
True
263 (wheel,) = tmpdir.visit(
"*.whl")
265 files = {f
"pybind11/{n}" for n
in all_files}
268 "dist-info/METADATA",
271 "dist-info/entry_points.txt",
272 "dist-info/top_level.txt",
275 with zipfile.ZipFile(
str(wheel))
as z:
278 trimmed = {n
for n
in names
if "dist-info" not in n}
279 trimmed |= {f
"dist-info/{n.split('/', 1)[-1]}" for n
in names
if "dist-info" in n}
280 assert files == trimmed
284 monkeypatch.chdir(MAIN_DIR)
285 monkeypatch.setenv(
"PYBIND11_GLOBAL_SDIST",
"1")
288 [sys.executable,
"-m",
"pip",
"wheel",
".",
"-w",
str(tmpdir)], check=
True
291 (wheel,) = tmpdir.visit(
"*.whl")
293 files = {f
"data/data/{n}" for n
in src_files}
294 files |= {f
"data/headers/{n[8:]}" for n
in headers}
297 "dist-info/METADATA",
299 "dist-info/top_level.txt",
303 with zipfile.ZipFile(
str(wheel))
as z:
306 beginning = names[0].
split(
"/", 1)[0].rsplit(
".", 1)[0]
307 trimmed = {n[
len(beginning) + 1 :]
for n
in names}
309 assert files == trimmed