forked from scikit-hep/awkward
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopy-cpp-headers.py
More file actions
44 lines (36 loc) · 1.3 KB
/
copy-cpp-headers.py
File metadata and controls
44 lines (36 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward/blob/main/LICENSE
"""Copy the header-only cpp headers into the various package directories that they are required"""
from __future__ import annotations
import pathlib
import shutil
root_path = pathlib.Path(__file__).absolute().parents[1]
if __name__ == "__main__":
header_only_path = root_path / "header-only"
# Copy to Python package under `awkward`
connect_path = (
root_path / "src" / "awkward" / "_connect" / "header-only" / "awkward"
)
if connect_path.exists():
shutil.rmtree(connect_path)
connect_path.mkdir(parents=True)
for path in header_only_path.rglob("*/awkward/*.h"):
dest_path = connect_path / path.name
shutil.copy(path, dest_path)
# Copy to C++ package
cpp_path = root_path / "awkward-cpp" / "header-only"
if cpp_path.exists():
shutil.rmtree(cpp_path)
components = (
"builder-options",
"growable-buffer",
"layout-builder",
"tests",
"CMakeLists.txt",
"README.md",
)
for component in components:
src_path = header_only_path / component
if src_path.is_file():
shutil.copy(src_path, cpp_path / component)
else:
shutil.copytree(src_path, cpp_path / component)