12 DIR = os.path.abspath(os.path.dirname(__file__))
13 MAIN_DIR = os.path.dirname(os.path.dirname(DIR))
16 prefix=${{pcfiledir}}/../../
17 includedir=${{prefix}}/include
20 Description: Seamless operability between C++11 and Python
22 Cflags: -I${{includedir}}
27 "include/pybind11/attr.h",
28 "include/pybind11/buffer_info.h",
29 "include/pybind11/cast.h",
30 "include/pybind11/chrono.h",
31 "include/pybind11/common.h",
32 "include/pybind11/complex.h",
33 "include/pybind11/eigen.h",
34 "include/pybind11/embed.h",
35 "include/pybind11/eval.h",
36 "include/pybind11/functional.h",
37 "include/pybind11/gil.h",
38 "include/pybind11/iostream.h",
39 "include/pybind11/numpy.h",
40 "include/pybind11/operators.h",
41 "include/pybind11/options.h",
42 "include/pybind11/pybind11.h",
43 "include/pybind11/pytypes.h",
44 "include/pybind11/stl.h",
45 "include/pybind11/stl_bind.h",
46 "include/pybind11/type_caster_pyobject_ptr.h",
50 "include/pybind11/detail/class.h",
51 "include/pybind11/detail/common.h",
52 "include/pybind11/detail/descr.h",
53 "include/pybind11/detail/init.h",
54 "include/pybind11/detail/internals.h",
55 "include/pybind11/detail/type_caster_base.h",
56 "include/pybind11/detail/typeid.h",
60 "include/pybind11/eigen/common.h",
61 "include/pybind11/eigen/matrix.h",
62 "include/pybind11/eigen/tensor.h",
66 "include/pybind11/stl/filesystem.h",
70 "share/cmake/pybind11/FindPythonLibsNew.cmake",
71 "share/cmake/pybind11/pybind11Common.cmake",
72 "share/cmake/pybind11/pybind11Config.cmake",
73 "share/cmake/pybind11/pybind11ConfigVersion.cmake",
74 "share/cmake/pybind11/pybind11NewTools.cmake",
75 "share/cmake/pybind11/pybind11Targets.cmake",
76 "share/cmake/pybind11/pybind11Tools.cmake",
80 "share/pkgconfig/pybind11.pc",
92 headers = main_headers | detail_headers | eigen_headers | stl_headers
93 src_files = headers | cmake_files | pkgconfig_files
94 all_files = src_files | py_files
100 "pybind11/include/pybind11",
101 "pybind11/include/pybind11/detail",
102 "pybind11/include/pybind11/eigen",
103 "pybind11/include/pybind11/stl",
105 "pybind11/share/cmake",
106 "pybind11/share/cmake/pybind11",
107 "pybind11/share/pkgconfig",
118 local_sdist_files = {
120 ".egg-info/PKG-INFO",
121 ".egg-info/SOURCES.txt",
122 ".egg-info/dependency_links.txt",
123 ".egg-info/not-zip-safe",
124 ".egg-info/top_level.txt",
129 start = tar.getnames()[0] +
"/"
130 inner_file = tar.extractfile(tar.getmember(f
"{start}{name}"))
132 with contextlib.closing(inner_file)
as f:
137 return value.replace(os.linesep.encode(
"utf-8"), b
"\n")
141 monkeypatch.chdir(MAIN_DIR)
144 [sys.executable,
"-m",
"build",
"--sdist", f
"--outdir={tmpdir}"], check=
True
147 (sdist,) = tmpdir.visit(
"*.tar.gz")
149 with tarfile.open(
str(sdist),
"r:gz")
as tar:
150 start = tar.getnames()[0] +
"/"
151 version = start[9:-1]
152 simpler = {n.split(
"/", 1)[-1]
for n
in tar.getnames()[1:]}
156 pkgconfig =
read_tz_file(tar,
"pybind11/share/pkgconfig/pybind11.pc")
158 tar,
"pybind11/share/cmake/pybind11/pybind11Config.cmake"
162 'set(pybind11_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")'
163 in cmake_cfg.decode(
"utf-8")
166 files = {f
"pybind11/{n}" for n
in all_files}
168 files |= {f
"pybind11{n}" for n
in local_sdist_files}
169 files.add(
"pybind11.egg-info/entry_points.txt")
170 files.add(
"pybind11.egg-info/requires.txt")
171 assert simpler == files
173 with open(os.path.join(MAIN_DIR,
"tools",
"setup_main.py.in"),
"rb")
as f:
175 string.Template(f.read().
decode(
"utf-8"))
176 .substitute(version=version, extra_cmd=
"")
179 assert setup_py == contents
181 with open(os.path.join(MAIN_DIR,
"tools",
"pyproject.toml"),
"rb")
as f:
183 assert pyproject_toml == contents
185 simple_version =
".".join(version.split(
".")[:3])
186 pkgconfig_expected = PKGCONFIG.format(VERSION=simple_version).
encode(
"utf-8")
191 monkeypatch.chdir(MAIN_DIR)
192 monkeypatch.setenv(
"PYBIND11_GLOBAL_SDIST",
"1")
194 [sys.executable,
"-m",
"build",
"--sdist",
"--outdir",
str(tmpdir)], check=
True
197 (sdist,) = tmpdir.visit(
"*.tar.gz")
199 with tarfile.open(
str(sdist),
"r:gz")
as tar:
200 start = tar.getnames()[0] +
"/"
201 version = start[16:-1]
202 simpler = {n.split(
"/", 1)[-1]
for n
in tar.getnames()[1:]}
206 pkgconfig =
read_tz_file(tar,
"pybind11/share/pkgconfig/pybind11.pc")
208 tar,
"pybind11/share/cmake/pybind11/pybind11Config.cmake"
212 'set(pybind11_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")'
213 in cmake_cfg.decode(
"utf-8")
216 files = {f
"pybind11/{n}" for n
in all_files}
218 files |= {f
"pybind11_global{n}" for n
in local_sdist_files}
219 assert simpler == files
221 with open(os.path.join(MAIN_DIR,
"tools",
"setup_global.py.in"),
"rb")
as f:
223 string.Template(f.read().
decode())
224 .substitute(version=version, extra_cmd=
"")
227 assert setup_py == contents
229 with open(os.path.join(MAIN_DIR,
"tools",
"pyproject.toml"),
"rb")
as f:
231 assert pyproject_toml == contents
233 simple_version =
".".join(version.split(
".")[:3])
234 pkgconfig_expected = PKGCONFIG.format(VERSION=simple_version).
encode(
"utf-8")
239 monkeypatch.chdir(MAIN_DIR)
242 [sys.executable,
"-m",
"pip",
"wheel",
".",
"-w",
str(tmpdir)], check=
True
245 (wheel,) = tmpdir.visit(
"*.whl")
247 files = {f
"pybind11/{n}" for n
in all_files}
250 "dist-info/METADATA",
253 "dist-info/entry_points.txt",
254 "dist-info/top_level.txt",
257 with zipfile.ZipFile(
str(wheel))
as z:
260 trimmed = {n
for n
in names
if "dist-info" not in n}
261 trimmed |= {f
"dist-info/{n.split('/', 1)[-1]}" for n
in names
if "dist-info" in n}
262 assert files == trimmed
266 monkeypatch.chdir(MAIN_DIR)
267 monkeypatch.setenv(
"PYBIND11_GLOBAL_SDIST",
"1")
270 [sys.executable,
"-m",
"pip",
"wheel",
".",
"-w",
str(tmpdir)], check=
True
273 (wheel,) = tmpdir.visit(
"*.whl")
275 files = {f
"data/data/{n}" for n
in src_files}
276 files |= {f
"data/headers/{n[8:]}" for n
in headers}
279 "dist-info/METADATA",
281 "dist-info/top_level.txt",
285 with zipfile.ZipFile(
str(wheel))
as z:
288 beginning = names[0].
split(
"/", 1)[0].rsplit(
".", 1)[0]
289 trimmed = {n[
len(beginning) + 1 :]
for n
in names}
291 assert files == trimmed