mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[upstream_utils] Rework upstream_utils scripts (#6829)
This commit is contained in:
52
upstream_utils/gcem.py
Executable file
52
upstream_utils/gcem.py
Executable 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()
|
||||
Reference in New Issue
Block a user