2022-05-09 01:21:54 -04:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
|
|
import shutil
|
[upstream_utils] Use pathlib instead of os.path (#7983)
A noteworthy change is the replacement of the `dp.startswith(os.path.join(".", "subdir"))` pattern. pathlib doesn't offer something with similar semantics besides `match` and `full_match`, so there's now a helper function that replicates the behavior.
Other notable changes include the addition of type annotations to ensure code correctness, using == to check file names instead of `endswith` for clarity (`endswith` is still used to check extensions), manual walking and copying being refactored in googletest, json, memory, nanopb, protobuf, and sleipnir to use `walk_cwd_and_copy_if`, and matching functions being shortened to the point where they can just be inlined into the lambda.
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2025-05-29 22:05:22 +00:00
|
|
|
from pathlib import Path
|
2022-05-09 01:21:54 -04:00
|
|
|
|
[upstream_utils] Use pathlib instead of os.path (#7983)
A noteworthy change is the replacement of the `dp.startswith(os.path.join(".", "subdir"))` pattern. pathlib doesn't offer something with similar semantics besides `match` and `full_match`, so there's now a helper function that replicates the behavior.
Other notable changes include the addition of type annotations to ensure code correctness, using == to check file names instead of `endswith` for clarity (`endswith` is still used to check extensions), manual walking and copying being refactored in googletest, json, memory, nanopb, protobuf, and sleipnir to use `walk_cwd_and_copy_if`, and matching functions being shortened to the point where they can just be inlined into the lambda.
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2025-05-29 22:05:22 +00:00
|
|
|
from upstream_utils import Lib, has_prefix, walk_cwd_and_copy_if
|
2022-05-09 01:21:54 -04:00
|
|
|
|
|
|
|
|
|
[upstream_utils] Use pathlib instead of os.path (#7983)
A noteworthy change is the replacement of the `dp.startswith(os.path.join(".", "subdir"))` pattern. pathlib doesn't offer something with similar semantics besides `match` and `full_match`, so there's now a helper function that replicates the behavior.
Other notable changes include the addition of type annotations to ensure code correctness, using == to check file names instead of `endswith` for clarity (`endswith` is still used to check extensions), manual walking and copying being refactored in googletest, json, memory, nanopb, protobuf, and sleipnir to use `walk_cwd_and_copy_if`, and matching functions being shortened to the point where they can just be inlined into the lambda.
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2025-05-29 22:05:22 +00:00
|
|
|
def copy_upstream_src(wpilib_root: Path):
|
|
|
|
|
wpinet = wpilib_root / "wpinet"
|
2022-05-09 01:21:54 -04:00
|
|
|
|
|
|
|
|
# Delete old install
|
|
|
|
|
for d in ["src/main/native/thirdparty/libuv"]:
|
[upstream_utils] Use pathlib instead of os.path (#7983)
A noteworthy change is the replacement of the `dp.startswith(os.path.join(".", "subdir"))` pattern. pathlib doesn't offer something with similar semantics besides `match` and `full_match`, so there's now a helper function that replicates the behavior.
Other notable changes include the addition of type annotations to ensure code correctness, using == to check file names instead of `endswith` for clarity (`endswith` is still used to check extensions), manual walking and copying being refactored in googletest, json, memory, nanopb, protobuf, and sleipnir to use `walk_cwd_and_copy_if`, and matching functions being shortened to the point where they can just be inlined into the lambda.
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2025-05-29 22:05:22 +00:00
|
|
|
shutil.rmtree(wpinet / d, ignore_errors=True)
|
2022-05-09 01:21:54 -04:00
|
|
|
|
|
|
|
|
include_ignorelist = [
|
|
|
|
|
"aix.h",
|
|
|
|
|
"os390.h",
|
|
|
|
|
"stdint-msvc2008.h",
|
|
|
|
|
"sunos.h",
|
|
|
|
|
]
|
|
|
|
|
|
2024-07-20 07:01:06 -07:00
|
|
|
walk_cwd_and_copy_if(
|
[upstream_utils] Use pathlib instead of os.path (#7983)
A noteworthy change is the replacement of the `dp.startswith(os.path.join(".", "subdir"))` pattern. pathlib doesn't offer something with similar semantics besides `match` and `full_match`, so there's now a helper function that replicates the behavior.
Other notable changes include the addition of type annotations to ensure code correctness, using == to check file names instead of `endswith` for clarity (`endswith` is still used to check extensions), manual walking and copying being refactored in googletest, json, memory, nanopb, protobuf, and sleipnir to use `walk_cwd_and_copy_if`, and matching functions being shortened to the point where they can just be inlined into the lambda.
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2025-05-29 22:05:22 +00:00
|
|
|
lambda dp, f: has_prefix(dp, Path("include")) and f not in include_ignorelist,
|
|
|
|
|
wpinet / "src/main/native/thirdparty/libuv",
|
2022-07-01 06:41:44 -07:00
|
|
|
)
|
2022-05-09 01:21:54 -04:00
|
|
|
|
|
|
|
|
src_ignorelist = [
|
|
|
|
|
"aix-common.c",
|
|
|
|
|
"aix.c",
|
|
|
|
|
"bsd-proctitle.c",
|
2022-05-18 20:40:27 -07:00
|
|
|
"darwin-stub.c",
|
2022-05-09 01:21:54 -04:00
|
|
|
"haiku.c",
|
2022-05-18 20:40:27 -07:00
|
|
|
"hurd.c",
|
|
|
|
|
"os390-proctitle.c",
|
2022-05-09 01:21:54 -04:00
|
|
|
"os390-syscalls.c",
|
|
|
|
|
"os390-syscalls.h",
|
|
|
|
|
"os390.c",
|
2022-05-18 20:40:27 -07:00
|
|
|
"qnx.c",
|
2022-05-09 01:21:54 -04:00
|
|
|
"sunos.c",
|
2022-05-18 20:40:27 -07:00
|
|
|
"sysinfo-loadavg.c",
|
2022-05-09 01:21:54 -04:00
|
|
|
"sysinfo-memory.c",
|
|
|
|
|
]
|
2024-07-20 07:01:06 -07:00
|
|
|
walk_cwd_and_copy_if(
|
[upstream_utils] Use pathlib instead of os.path (#7983)
A noteworthy change is the replacement of the `dp.startswith(os.path.join(".", "subdir"))` pattern. pathlib doesn't offer something with similar semantics besides `match` and `full_match`, so there's now a helper function that replicates the behavior.
Other notable changes include the addition of type annotations to ensure code correctness, using == to check file names instead of `endswith` for clarity (`endswith` is still used to check extensions), manual walking and copying being refactored in googletest, json, memory, nanopb, protobuf, and sleipnir to use `walk_cwd_and_copy_if`, and matching functions being shortened to the point where they can just be inlined into the lambda.
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2025-05-29 22:05:22 +00:00
|
|
|
lambda dp, f: has_prefix(dp, Path("src")) and f not in src_ignorelist,
|
|
|
|
|
wpinet / "src/main/native/thirdparty/libuv",
|
2024-07-20 07:00:13 -07:00
|
|
|
rename_c_to_cpp=True,
|
2022-07-01 06:41:44 -07:00
|
|
|
)
|
2022-05-09 01:21:54 -04:00
|
|
|
|
|
|
|
|
|
2024-07-16 17:20:07 -07:00
|
|
|
def main():
|
|
|
|
|
name = "libuv"
|
|
|
|
|
url = "https://github.com/libuv/libuv"
|
2024-10-19 09:55:45 -07:00
|
|
|
tag = "v1.49.2"
|
2024-07-16 17:20:07 -07:00
|
|
|
|
2024-07-23 15:58:15 -07:00
|
|
|
libuv = Lib(name, url, tag, copy_upstream_src)
|
2024-07-16 17:20:07 -07:00
|
|
|
libuv.main()
|
|
|
|
|
|
|
|
|
|
|
2022-05-09 01:21:54 -04:00
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|