[upstream_utils] Rework upstream_utils scripts (#6829)

This commit is contained in:
Joseph Eng
2024-07-16 17:20:07 -07:00
committed by GitHub
parent f9d32ad706
commit 5f261a88af
15 changed files with 698 additions and 275 deletions

52
upstream_utils/gcem.py Executable file
View File

@@ -0,0 +1,52 @@
#!/usr/bin/env python3
import os
import shutil
from upstream_utils import (
get_repo_root,
clone_repo,
comment_out_invalid_includes,
walk_cwd_and_copy_if,
git_am,
Lib,
)
def copy_upstream_src(wpilib_root):
wpimath = os.path.join(wpilib_root, "wpimath")
# Delete old install
for d in [
"src/main/native/thirdparty/gcem/include",
]:
shutil.rmtree(os.path.join(wpimath, d), ignore_errors=True)
# Copy gcem include files into allwpilib
include_files = walk_cwd_and_copy_if(
lambda dp, f: dp.startswith("./include"),
os.path.join(wpimath, "src/main/native/thirdparty/gcem"),
)
for f in include_files:
comment_out_invalid_includes(
f, [os.path.join(wpimath, "src/main/native/thirdparty/gcem/include")]
)
def main():
name = "gcem"
url = "https://github.com/kthohr/gcem.git"
tag = "v1.18.0"
patch_list = [
"0001-Call-std-functions-if-not-constant-evaluated.patch",
"0002-Add-hypot-x-y-z.patch",
]
gcem = Lib(name, url, tag, patch_list, copy_upstream_src)
gcem.main()
if __name__ == "__main__":
main()