blob: 0f3fe1f7b926e4c84c8319fe2f8253595f3ced59 [file] [log] [blame]
James Kuszmaulcf324122023-01-14 14:07:17 -08001#!/usr/bin/env python3
2
3import os
4import shutil
5
6from upstream_utils import (
7 get_repo_root,
8 clone_repo,
9 comment_out_invalid_includes,
10 walk_cwd_and_copy_if,
11 git_am,
12)
13
14
15def main():
James Kuszmaulb13e13f2023-11-22 20:44:04 -080016 upstream_root = clone_repo("https://github.com/kthohr/gcem.git", "v1.17.0")
James Kuszmaulcf324122023-01-14 14:07:17 -080017 wpilib_root = get_repo_root()
18 wpimath = os.path.join(wpilib_root, "wpimath")
19
20 # Apply patches to upstream Git repo
21 os.chdir(upstream_root)
22 for f in []:
23 git_am(os.path.join(wpilib_root, "upstream_utils/gcem_patches", f))
24
25 # Delete old install
26 for d in [
27 "src/main/native/thirdparty/gcem/include",
28 ]:
29 shutil.rmtree(os.path.join(wpimath, d), ignore_errors=True)
30
31 # Copy gcem include files into allwpilib
32 include_files = walk_cwd_and_copy_if(
James Kuszmaulb13e13f2023-11-22 20:44:04 -080033 lambda dp, f: dp.startswith("./include"),
James Kuszmaulcf324122023-01-14 14:07:17 -080034 os.path.join(wpimath, "src/main/native/thirdparty/gcem"),
35 )
36
37 for f in include_files:
38 comment_out_invalid_includes(
39 f, [os.path.join(wpimath, "src/main/native/thirdparty/gcem/include")]
40 )
41
42
43if __name__ == "__main__":
44 main()