13 DIR = os.path.abspath(os.path.dirname(__file__))
14 MAIN_DIR = os.path.dirname(os.path.dirname(DIR))
18 "include/pybind11/attr.h",
19 "include/pybind11/buffer_info.h",
20 "include/pybind11/cast.h",
21 "include/pybind11/chrono.h",
22 "include/pybind11/common.h",
23 "include/pybind11/complex.h",
24 "include/pybind11/eigen.h",
25 "include/pybind11/embed.h",
26 "include/pybind11/eval.h",
27 "include/pybind11/functional.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/typeid.h",
48 "share/cmake/pybind11/FindPythonLibsNew.cmake",
49 "share/cmake/pybind11/pybind11Common.cmake",
50 "share/cmake/pybind11/pybind11Config.cmake",
51 "share/cmake/pybind11/pybind11ConfigVersion.cmake",
52 "share/cmake/pybind11/pybind11NewTools.cmake",
53 "share/cmake/pybind11/pybind11Targets.cmake",
54 "share/cmake/pybind11/pybind11Tools.cmake",
68 headers = main_headers | detail_headers
69 src_files = headers | cmake_files
70 all_files = src_files | py_files
76 "pybind11/include/pybind11",
77 "pybind11/include/pybind11/detail",
79 "pybind11/share/cmake",
80 "pybind11/share/cmake/pybind11",
93 ".egg-info/SOURCES.txt",
94 ".egg-info/dependency_links.txt",
95 ".egg-info/not-zip-safe",
96 ".egg-info/top_level.txt",
102 monkeypatch.chdir(MAIN_DIR)
104 out = subprocess.check_output(
117 (sdist,) = tmpdir.visit(
"*.tar")
119 with tarfile.open(
str(sdist))
as tar:
120 start = tar.getnames()[0] +
"/"
121 version = start[9:-1]
122 simpler =
set(n.split(
"/", 1)[-1]
for n
in tar.getnames()[1:])
124 with contextlib.closing(
125 tar.extractfile(tar.getmember(start +
"setup.py"))
129 with contextlib.closing(
130 tar.extractfile(tar.getmember(start +
"pyproject.toml"))
132 pyproject_toml = f.read()
134 files =
set(
"pybind11/{}".format(n)
for n
in all_files)
136 files |=
set(
"pybind11{}".format(n)
for n
in local_sdist_files)
137 files.add(
"pybind11.egg-info/entry_points.txt")
138 files.add(
"pybind11.egg-info/requires.txt")
139 assert simpler == files
141 with open(os.path.join(MAIN_DIR,
"tools",
"setup_main.py.in"),
"rb")
as f:
143 string.Template(f.read().decode())
144 .substitute(version=version, extra_cmd=
"")
147 assert setup_py == contents
149 with open(os.path.join(MAIN_DIR,
"tools",
"pyproject.toml"),
"rb")
as f:
151 assert pyproject_toml == contents
156 monkeypatch.chdir(MAIN_DIR)
157 monkeypatch.setenv(
"PYBIND11_GLOBAL_SDIST",
"1")
159 out = subprocess.check_output(
172 (sdist,) = tmpdir.visit(
"*.tar")
174 with tarfile.open(
str(sdist))
as tar:
175 start = tar.getnames()[0] +
"/"
176 version = start[16:-1]
177 simpler =
set(n.split(
"/", 1)[-1]
for n
in tar.getnames()[1:])
179 with contextlib.closing(
180 tar.extractfile(tar.getmember(start +
"setup.py"))
184 with contextlib.closing(
185 tar.extractfile(tar.getmember(start +
"pyproject.toml"))
187 pyproject_toml = f.read()
189 files =
set(
"pybind11/{}".format(n)
for n
in all_files)
191 files |=
set(
"pybind11_global{}".format(n)
for n
in local_sdist_files)
192 assert simpler == files
194 with open(os.path.join(MAIN_DIR,
"tools",
"setup_global.py.in"),
"rb")
as f:
196 string.Template(f.read().decode())
197 .substitute(version=version, extra_cmd=
"")
200 assert setup_py == contents
202 with open(os.path.join(MAIN_DIR,
"tools",
"pyproject.toml"),
"rb")
as f:
204 assert pyproject_toml == contents
208 monkeypatch.chdir(MAIN_DIR)
210 subprocess.check_output(
211 [sys.executable,
"-m",
"pip",
"wheel",
".",
"-w",
str(tmpdir)]
214 (wheel,) = tmpdir.visit(
"*.whl")
216 files =
set(
"pybind11/{}".format(n)
for n
in all_files)
219 "dist-info/METADATA",
222 "dist-info/entry_points.txt",
223 "dist-info/top_level.txt",
226 with zipfile.ZipFile(
str(wheel))
as z:
229 trimmed =
set(n
for n
in names
if "dist-info" not in n)
231 "dist-info/{}".format(n.split(
"/", 1)[-1])
for n
in names
if "dist-info" in n
233 assert files == trimmed
237 monkeypatch.chdir(MAIN_DIR)
238 monkeypatch.setenv(
"PYBIND11_GLOBAL_SDIST",
"1")
240 subprocess.check_output(
241 [sys.executable,
"-m",
"pip",
"wheel",
".",
"-w",
str(tmpdir)]
244 (wheel,) = tmpdir.visit(
"*.whl")
246 files =
set(
"data/data/{}".format(n)
for n
in src_files)
247 files |=
set(
"data/headers/{}".format(n[8:])
for n
in headers)
250 "dist-info/METADATA",
252 "dist-info/top_level.txt",
256 with zipfile.ZipFile(
str(wheel))
as z:
259 beginning = names[0].split(
"/", 1)[0].rsplit(
".", 1)[0]
260 trimmed =
set(n[
len(beginning) + 1 :]
for n
in names)
262 assert files == trimmed