12 DIR = os.path.abspath(os.path.dirname(__file__))
13 MAIN_DIR = os.path.dirname(os.path.dirname(DIR))
17 "include/pybind11/attr.h",
18 "include/pybind11/buffer_info.h",
19 "include/pybind11/cast.h",
20 "include/pybind11/chrono.h",
21 "include/pybind11/common.h",
22 "include/pybind11/complex.h",
23 "include/pybind11/eigen.h",
24 "include/pybind11/embed.h",
25 "include/pybind11/eval.h",
26 "include/pybind11/functional.h",
27 "include/pybind11/gil.h",
28 "include/pybind11/iostream.h",
29 "include/pybind11/numpy.h",
30 "include/pybind11/operators.h",
31 "include/pybind11/options.h",
32 "include/pybind11/pybind11.h",
33 "include/pybind11/pytypes.h",
34 "include/pybind11/stl.h",
35 "include/pybind11/stl_bind.h",
39 "include/pybind11/detail/class.h",
40 "include/pybind11/detail/common.h",
41 "include/pybind11/detail/descr.h",
42 "include/pybind11/detail/init.h",
43 "include/pybind11/detail/internals.h",
44 "include/pybind11/detail/type_caster_base.h",
45 "include/pybind11/detail/typeid.h",
49 "include/pybind11/stl/filesystem.h",
53 "share/cmake/pybind11/FindPythonLibsNew.cmake",
54 "share/cmake/pybind11/pybind11Common.cmake",
55 "share/cmake/pybind11/pybind11Config.cmake",
56 "share/cmake/pybind11/pybind11ConfigVersion.cmake",
57 "share/cmake/pybind11/pybind11NewTools.cmake",
58 "share/cmake/pybind11/pybind11Targets.cmake",
59 "share/cmake/pybind11/pybind11Tools.cmake",
71 headers = main_headers | detail_headers | stl_headers
72 src_files = headers | cmake_files
73 all_files = src_files | py_files
79 "pybind11/include/pybind11",
80 "pybind11/include/pybind11/detail",
81 "pybind11/include/pybind11/stl",
83 "pybind11/share/cmake",
84 "pybind11/share/cmake/pybind11",
97 ".egg-info/SOURCES.txt",
98 ".egg-info/dependency_links.txt",
99 ".egg-info/not-zip-safe",
100 ".egg-info/top_level.txt",
106 monkeypatch.chdir(MAIN_DIR)
108 out = subprocess.check_output(
121 (sdist,) = tmpdir.visit(
"*.tar.gz")
123 with tarfile.open(
str(sdist),
"r:gz")
as tar:
124 start = tar.getnames()[0] +
"/" 125 version = start[9:-1]
126 simpler = {n.split(
"/", 1)[-1]
for n
in tar.getnames()[1:]}
128 with contextlib.closing(
129 tar.extractfile(tar.getmember(start +
"setup.py"))
133 with contextlib.closing(
134 tar.extractfile(tar.getmember(start +
"pyproject.toml"))
136 pyproject_toml = f.read()
138 with contextlib.closing(
141 start +
"pybind11/share/cmake/pybind11/pybind11Config.cmake" 145 contents = f.read().
decode(
"utf8")
146 assert 'set(pybind11_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")' in contents
148 files = {f
"pybind11/{n}" for n
in all_files}
150 files |= {f
"pybind11{n}" for n
in local_sdist_files}
151 files.add(
"pybind11.egg-info/entry_points.txt")
152 files.add(
"pybind11.egg-info/requires.txt")
153 assert simpler == files
155 with open(os.path.join(MAIN_DIR,
"tools",
"setup_main.py.in"),
"rb")
as f:
157 string.Template(f.read().
decode())
158 .substitute(version=version, extra_cmd=
"")
161 assert setup_py == contents
163 with open(os.path.join(MAIN_DIR,
"tools",
"pyproject.toml"),
"rb")
as f:
165 assert pyproject_toml == contents
170 monkeypatch.chdir(MAIN_DIR)
171 monkeypatch.setenv(
"PYBIND11_GLOBAL_SDIST",
"1")
172 out = subprocess.check_output(
186 (sdist,) = tmpdir.visit(
"*.tar.gz")
188 with tarfile.open(
str(sdist),
"r:gz")
as tar:
189 start = tar.getnames()[0] +
"/" 190 version = start[16:-1]
191 simpler = {n.split(
"/", 1)[-1]
for n
in tar.getnames()[1:]}
193 with contextlib.closing(
194 tar.extractfile(tar.getmember(start +
"setup.py"))
198 with contextlib.closing(
199 tar.extractfile(tar.getmember(start +
"pyproject.toml"))
201 pyproject_toml = f.read()
203 files = {f
"pybind11/{n}" for n
in all_files}
205 files |= {f
"pybind11_global{n}" for n
in local_sdist_files}
206 assert simpler == files
208 with open(os.path.join(MAIN_DIR,
"tools",
"setup_global.py.in"),
"rb")
as f:
210 string.Template(f.read().
decode())
211 .substitute(version=version, extra_cmd=
"")
214 assert setup_py == contents
216 with open(os.path.join(MAIN_DIR,
"tools",
"pyproject.toml"),
"rb")
as f:
218 assert pyproject_toml == contents
222 monkeypatch.chdir(MAIN_DIR)
224 subprocess.check_output(
225 [sys.executable,
"-m",
"pip",
"wheel",
".",
"-w",
str(tmpdir)]
228 (wheel,) = tmpdir.visit(
"*.whl")
230 files = {f
"pybind11/{n}" for n
in all_files}
233 "dist-info/METADATA",
236 "dist-info/entry_points.txt",
237 "dist-info/top_level.txt",
240 with zipfile.ZipFile(
str(wheel))
as z:
243 trimmed = {n
for n
in names
if "dist-info" not in n}
244 trimmed |= {f
"dist-info/{n.split('/', 1)[-1]}" for n
in names
if "dist-info" in n}
245 assert files == trimmed
249 monkeypatch.chdir(MAIN_DIR)
250 monkeypatch.setenv(
"PYBIND11_GLOBAL_SDIST",
"1")
252 subprocess.check_output(
253 [sys.executable,
"-m",
"pip",
"wheel",
".",
"-w",
str(tmpdir)]
256 (wheel,) = tmpdir.visit(
"*.whl")
258 files = {f
"data/data/{n}" for n
in src_files}
259 files |= {f
"data/headers/{n[8:]}" for n
in headers}
262 "dist-info/METADATA",
264 "dist-info/top_level.txt",
268 with zipfile.ZipFile(
str(wheel))
as z:
271 beginning = names[0].
split(
"/", 1)[0].rsplit(
".", 1)[0]
272 trimmed = {n[
len(beginning) + 1 :]
for n
in names}
274 assert files == trimmed
bool hasattr(handle obj, handle name)
def test_build_global_dist(monkeypatch, tmpdir)
void split(const G &g, const PredecessorMap< KEY > &tree, G &Ab1, G &Ab2)
def tests_build_wheel(monkeypatch, tmpdir)
def test_build_sdist(monkeypatch, tmpdir)
def tests_build_global_wheel(monkeypatch, tmpdir)
IndexPair decode(Index ij)
int encode(Index i, Index j)
size_t len(handle h)
Get the length of a Python object.