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",
65 headers = main_headers | detail_headers
66 src_files = headers | cmake_files
67 all_files = src_files | py_files
73 "pybind11/include/pybind11",
74 "pybind11/include/pybind11/detail",
76 "pybind11/share/cmake",
77 "pybind11/share/cmake/pybind11",
90 ".egg-info/SOURCES.txt",
91 ".egg-info/dependency_links.txt",
92 ".egg-info/not-zip-safe",
93 ".egg-info/top_level.txt",
99 monkeypatch.chdir(MAIN_DIR)
101 out = subprocess.check_output(
114 (sdist,) = tmpdir.visit(
"*.tar")
116 with tarfile.open(
str(sdist))
as tar:
117 start = tar.getnames()[0] +
"/" 118 version = start[9:-1]
119 simpler =
set(n.split(
"/", 1)[-1]
for n
in tar.getnames()[1:])
121 with contextlib.closing(
122 tar.extractfile(tar.getmember(start +
"setup.py"))
126 with contextlib.closing(
127 tar.extractfile(tar.getmember(start +
"pyproject.toml"))
129 pyproject_toml = f.read()
131 files =
set(
"pybind11/{}".format(n)
for n
in all_files)
133 files |=
set(
"pybind11{}".format(n)
for n
in local_sdist_files)
134 files.add(
"pybind11.egg-info/entry_points.txt")
135 files.add(
"pybind11.egg-info/requires.txt")
136 assert simpler == files
138 with open(os.path.join(MAIN_DIR,
"tools",
"setup_main.py.in"),
"rb")
as f:
140 string.Template(f.read().decode())
141 .substitute(version=version, extra_cmd=
"")
144 assert setup_py == contents
146 with open(os.path.join(MAIN_DIR,
"tools",
"pyproject.toml"),
"rb")
as f:
148 assert pyproject_toml == contents
153 monkeypatch.chdir(MAIN_DIR)
154 monkeypatch.setenv(
"PYBIND11_GLOBAL_SDIST",
"1")
156 out = subprocess.check_output(
169 (sdist,) = tmpdir.visit(
"*.tar")
171 with tarfile.open(
str(sdist))
as tar:
172 start = tar.getnames()[0] +
"/" 173 version = start[16:-1]
174 simpler =
set(n.split(
"/", 1)[-1]
for n
in tar.getnames()[1:])
176 with contextlib.closing(
177 tar.extractfile(tar.getmember(start +
"setup.py"))
181 with contextlib.closing(
182 tar.extractfile(tar.getmember(start +
"pyproject.toml"))
184 pyproject_toml = f.read()
186 files =
set(
"pybind11/{}".format(n)
for n
in all_files)
188 files |=
set(
"pybind11_global{}".format(n)
for n
in local_sdist_files)
189 assert simpler == files
191 with open(os.path.join(MAIN_DIR,
"tools",
"setup_global.py.in"),
"rb")
as f:
193 string.Template(f.read().decode())
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
205 monkeypatch.chdir(MAIN_DIR)
207 subprocess.check_output(
208 [sys.executable,
"-m",
"pip",
"wheel",
".",
"-w",
str(tmpdir)]
211 (wheel,) = tmpdir.visit(
"*.whl")
213 files =
set(
"pybind11/{}".format(n)
for n
in all_files)
216 "dist-info/METADATA",
219 "dist-info/entry_points.txt",
220 "dist-info/top_level.txt",
223 with zipfile.ZipFile(
str(wheel))
as z:
226 trimmed =
set(n
for n
in names
if "dist-info" not in n)
228 "dist-info/{}".format(n.split(
"/", 1)[-1])
for n
in names
if "dist-info" in n
230 assert files == trimmed
234 monkeypatch.chdir(MAIN_DIR)
235 monkeypatch.setenv(
"PYBIND11_GLOBAL_SDIST",
"1")
237 subprocess.check_output(
238 [sys.executable,
"-m",
"pip",
"wheel",
".",
"-w",
str(tmpdir)]
241 (wheel,) = tmpdir.visit(
"*.whl")
243 files =
set(
"data/data/{}".format(n)
for n
in src_files)
244 files |=
set(
"data/headers/{}".format(n[8:])
for n
in headers)
247 "dist-info/METADATA",
249 "dist-info/top_level.txt",
253 with zipfile.ZipFile(
str(wheel))
as z:
256 beginning = names[0].
split(
"/", 1)[0].rsplit(
".", 1)[0]
257 trimmed =
set(n[
len(beginning) + 1 :]
for n
in names)
259 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)