2024-04-27 22:42:42 -07:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
import shutil
|
|
|
|
|
|
2024-11-02 17:56:55 -07:00
|
|
|
from upstream_utils import Lib, copy_to
|
2024-04-27 22:42:42 -07:00
|
|
|
|
|
|
|
|
|
2024-07-16 17:20:07 -07:00
|
|
|
def copy_upstream_src(wpilib_root):
|
2024-04-27 22:42:42 -07:00
|
|
|
wpimath = os.path.join(wpilib_root, "wpimath")
|
|
|
|
|
|
|
|
|
|
# Delete old install
|
|
|
|
|
for d in [
|
|
|
|
|
"src/main/native/thirdparty/sleipnir/src",
|
|
|
|
|
"src/main/native/thirdparty/sleipnir/include",
|
|
|
|
|
]:
|
|
|
|
|
shutil.rmtree(os.path.join(wpimath, d), ignore_errors=True)
|
|
|
|
|
|
|
|
|
|
# Copy Sleipnir source files into allwpilib
|
|
|
|
|
src_files = [os.path.join(dp, f) for dp, dn, fn in os.walk("src") for f in fn]
|
|
|
|
|
src_files = copy_to(
|
|
|
|
|
src_files, os.path.join(wpimath, "src/main/native/thirdparty/sleipnir")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Copy Sleipnir header files into allwpilib
|
|
|
|
|
include_files = [
|
2024-06-21 11:14:19 -07:00
|
|
|
os.path.join(dp, f)
|
|
|
|
|
for dp, dn, fn in os.walk("include")
|
|
|
|
|
for f in fn
|
|
|
|
|
if not f.endswith("small_vector.hpp")
|
2024-04-27 22:42:42 -07:00
|
|
|
]
|
|
|
|
|
include_files = copy_to(
|
|
|
|
|
include_files, os.path.join(wpimath, "src/main/native/thirdparty/sleipnir")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
for filename in [
|
|
|
|
|
".clang-format",
|
|
|
|
|
".clang-tidy",
|
|
|
|
|
".styleguide",
|
|
|
|
|
".styleguide-license",
|
|
|
|
|
]:
|
|
|
|
|
shutil.copyfile(
|
2024-07-16 17:20:07 -07:00
|
|
|
filename,
|
2024-04-27 22:42:42 -07:00
|
|
|
os.path.join(wpimath, "src/main/native/thirdparty/sleipnir", filename),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2024-07-16 17:20:07 -07:00
|
|
|
def main():
|
|
|
|
|
name = "sleipnir"
|
|
|
|
|
url = "https://github.com/SleipnirGroup/Sleipnir"
|
2024-12-07 23:02:39 -08:00
|
|
|
# main on 2024-12-07
|
|
|
|
|
tag = "01206ab17d741f4c45a7faeb56b8a5442df1681c"
|
2024-07-16 17:20:07 -07:00
|
|
|
|
2024-07-23 15:58:15 -07:00
|
|
|
sleipnir = Lib(name, url, tag, copy_upstream_src)
|
2024-07-16 17:20:07 -07:00
|
|
|
sleipnir.main()
|
|
|
|
|
|
|
|
|
|
|
2024-04-27 22:42:42 -07:00
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|