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/descr.h",
57 "include/pybind11/detail/init.h",
58 "include/pybind11/detail/internals.h",
59 "include/pybind11/detail/type_caster_base.h",
60 "include/pybind11/detail/typeid.h",
64 "include/pybind11/eigen/common.h",
65 "include/pybind11/eigen/matrix.h",
66 "include/pybind11/eigen/tensor.h",
70 "include/pybind11/stl/filesystem.h",
74 "share/cmake/pybind11/FindPythonLibsNew.cmake",
75 "share/cmake/pybind11/pybind11Common.cmake",
76 "share/cmake/pybind11/pybind11Config.cmake",
77 "share/cmake/pybind11/pybind11ConfigVersion.cmake",
78 "share/cmake/pybind11/pybind11GuessPythonExtSuffix.cmake",
79 "share/cmake/pybind11/pybind11NewTools.cmake",
80 "share/cmake/pybind11/pybind11Targets.cmake",
81 "share/cmake/pybind11/pybind11Tools.cmake",
85 "share/pkgconfig/pybind11.pc",
97 headers = main_headers | detail_headers | eigen_headers | stl_headers
98 src_files = headers | cmake_files | pkgconfig_files
99 all_files = src_files | py_files
105 "pybind11/include/pybind11",
106 "pybind11/include/pybind11/detail",
107 "pybind11/include/pybind11/eigen",
108 "pybind11/include/pybind11/stl",
110 "pybind11/share/cmake",
111 "pybind11/share/cmake/pybind11",
112 "pybind11/share/pkgconfig",
123 local_sdist_files = {
125 ".egg-info/PKG-INFO",
126 ".egg-info/SOURCES.txt",
127 ".egg-info/dependency_links.txt",
128 ".egg-info/not-zip-safe",
129 ".egg-info/top_level.txt",
134 start = tar.getnames()[0] +
"/"
135 inner_file = tar.extractfile(tar.getmember(f
"{start}{name}"))
137 with contextlib.closing(inner_file)
as f:
142 return value.replace(os.linesep.encode(
"utf-8"), b
"\n")
146 monkeypatch.chdir(MAIN_DIR)
149 [sys.executable,
"-m",
"build",
"--sdist", f
"--outdir={tmpdir}"], check=
True
152 (sdist,) = tmpdir.visit(
"*.tar.gz")
154 with tarfile.open(
str(sdist),
"r:gz")
as tar:
155 start = tar.getnames()[0] +
"/"
156 version = start[9:-1]
157 simpler = {n.split(
"/", 1)[-1]
for n
in tar.getnames()[1:]}
161 pkgconfig =
read_tz_file(tar,
"pybind11/share/pkgconfig/pybind11.pc")
163 tar,
"pybind11/share/cmake/pybind11/pybind11Config.cmake"
167 'set(pybind11_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")'
168 in cmake_cfg.decode(
"utf-8")
171 files = {f
"pybind11/{n}" for n
in all_files}
173 files |= {f
"pybind11{n}" for n
in local_sdist_files}
174 files.add(
"pybind11.egg-info/entry_points.txt")
175 files.add(
"pybind11.egg-info/requires.txt")
176 assert simpler == files
178 with open(os.path.join(MAIN_DIR,
"tools",
"setup_main.py.in"),
"rb")
as f:
180 string.Template(f.read().
decode(
"utf-8"))
181 .substitute(version=version, extra_cmd=
"")
184 assert setup_py == contents
186 with open(os.path.join(MAIN_DIR,
"tools",
"pyproject.toml"),
"rb")
as f:
188 assert pyproject_toml == contents
190 simple_version =
".".join(version.split(
".")[:3])
191 pkgconfig_expected = PKGCONFIG.format(VERSION=simple_version).
encode(
"utf-8")
196 monkeypatch.chdir(MAIN_DIR)
197 monkeypatch.setenv(
"PYBIND11_GLOBAL_SDIST",
"1")
199 [sys.executable,
"-m",
"build",
"--sdist",
"--outdir",
str(tmpdir)], check=
True
202 (sdist,) = tmpdir.visit(
"*.tar.gz")
204 with tarfile.open(
str(sdist),
"r:gz")
as tar:
205 start = tar.getnames()[0] +
"/"
206 version = start[16:-1]
207 simpler = {n.split(
"/", 1)[-1]
for n
in tar.getnames()[1:]}
211 pkgconfig =
read_tz_file(tar,
"pybind11/share/pkgconfig/pybind11.pc")
213 tar,
"pybind11/share/cmake/pybind11/pybind11Config.cmake"
217 'set(pybind11_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")'
218 in cmake_cfg.decode(
"utf-8")
221 files = {f
"pybind11/{n}" for n
in all_files}
223 files |= {f
"pybind11_global{n}" for n
in local_sdist_files}
224 assert simpler == files
226 with open(os.path.join(MAIN_DIR,
"tools",
"setup_global.py.in"),
"rb")
as f:
228 string.Template(f.read().
decode())
229 .substitute(version=version, extra_cmd=
"")
232 assert setup_py == contents
234 with open(os.path.join(MAIN_DIR,
"tools",
"pyproject.toml"),
"rb")
as f:
236 assert pyproject_toml == contents
238 simple_version =
".".join(version.split(
".")[:3])
239 pkgconfig_expected = PKGCONFIG.format(VERSION=simple_version).
encode(
"utf-8")
244 monkeypatch.chdir(MAIN_DIR)
247 [sys.executable,
"-m",
"pip",
"wheel",
".",
"-w",
str(tmpdir)], check=
True
250 (wheel,) = tmpdir.visit(
"*.whl")
252 files = {f
"pybind11/{n}" for n
in all_files}
255 "dist-info/METADATA",
258 "dist-info/entry_points.txt",
259 "dist-info/top_level.txt",
262 with zipfile.ZipFile(
str(wheel))
as z:
265 trimmed = {n
for n
in names
if "dist-info" not in n}
266 trimmed |= {f
"dist-info/{n.split('/', 1)[-1]}" for n
in names
if "dist-info" in n}
267 assert files == trimmed
271 monkeypatch.chdir(MAIN_DIR)
272 monkeypatch.setenv(
"PYBIND11_GLOBAL_SDIST",
"1")
275 [sys.executable,
"-m",
"pip",
"wheel",
".",
"-w",
str(tmpdir)], check=
True
278 (wheel,) = tmpdir.visit(
"*.whl")
280 files = {f
"data/data/{n}" for n
in src_files}
281 files |= {f
"data/headers/{n[8:]}" for n
in headers}
284 "dist-info/METADATA",
286 "dist-info/top_level.txt",
290 with zipfile.ZipFile(
str(wheel))
as z:
293 beginning = names[0].
split(
"/", 1)[0].rsplit(
".", 1)[0]
294 trimmed = {n[
len(beginning) + 1 :]
for n
in names}
296 assert files == trimmed