[ci] Upgrade to wpiformat 2026.64 (#8993)

This commit is contained in:
Tyler Veness
2026-06-19 06:40:55 -07:00
committed by GitHub
parent e92478c212
commit ad797456f5
16 changed files with 130 additions and 100 deletions

View File

@@ -36,7 +36,7 @@ jobs:
- name: Install wpiformat
run: |
python -m venv ${{ runner.temp }}/wpiformat
${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2026.57
${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2026.64
- name: Run
run: ${{ runner.temp }}/wpiformat/bin/wpiformat
- name: Check output
@@ -78,7 +78,7 @@ jobs:
- name: Install wpiformat
run: |
python -m venv ${{ runner.temp }}/wpiformat
${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2026.57
${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2026.64
- name: Create compile_commands.json
run: |
./gradlew generateCompileCommands -Ptoolchain-optional-roboRio

View File

@@ -70,7 +70,7 @@ class HeaderToDatConfig:
include_root = str(args[3]).replace("\\", "/")
root_dir = find_root_dir(include_root)
if "native" in include_root:
base_include_root = pathlib.Path(*args[3].relative_to(root_dir).parts[3:])
# base_include_root = pathlib.Path(*args[3].relative_to(root_dir).parts[3:])
base_include_file = args[2].relative_to(include_root)
base_library = re.search("native/(.*?)/", include_root).groups(1)[0]
@@ -205,7 +205,6 @@ class BazelExtensionModule:
dynamic_dependencies = set()
for dep_name in all_dependencies:
if "native" in dep_name:
transitive_deps = set()
self._get_transitive_native_dependencies(dep_name, transitive_deps)
for d in transitive_deps:
@@ -416,7 +415,7 @@ def generate_pybind_build_file(
version_file = raw_config["tool"]["hatch"]["build"]["hooks"]["robotpy"][
"version_file"
]
except:
except KeyError:
version_file = None
# The entry points defined above are implicit to how the project is broken down in the toml files.

View File

@@ -282,7 +282,7 @@ def _write_libinit_py(
contents += [
" except FileNotFoundError:",
f" if not exists(lib_path):",
" if not exists(lib_path):",
f' raise FileNotFoundError("{lib.name} was not found on your system. Is this package correctly installed?")',
]

View File

@@ -18,7 +18,6 @@ def _convert_validation_error(
e: typing.Optional[BaseException] = ve
while e is not None:
if isinstance(e, errors.WrongFieldError):
locs.append(f".{e.wrong_field}")
elif isinstance(e, errors.WrongListItemError):

View File

@@ -38,21 +38,25 @@ def copy_upstream_src(wpilib_root: Path):
# Copy apriltag source files into allwpilib
src_files = walk_cwd_and_copy_if(
lambda dp, f: (f.endswith(".c") or f.endswith(".cpp"))
and not has_prefix(dp, Path("example"))
and not has_prefix(dp, Path("test"))
and not f == "getopt.c"
and not "py" in f
and not remove_tag(f),
lambda dp, f: (
(f.endswith(".c") or f.endswith(".cpp"))
and not has_prefix(dp, Path("example"))
and not has_prefix(dp, Path("test"))
and not f == "getopt.c"
and "py" not in f
and not remove_tag(f)
),
apriltag / "src/main/native/thirdparty/apriltag/src",
)
# Copy apriltag header files into allwpilib
walk_cwd_and_copy_if(
lambda dp, f: f.endswith(".h")
and not f == "getopt.h"
and not f == "postscript_utils.h"
and not remove_tag(f),
lambda dp, f: (
f.endswith(".h")
and not f == "getopt.h"
and not f == "postscript_utils.h"
and not remove_tag(f)
),
apriltag / "src/main/native/thirdparty/apriltag/include",
)

View File

@@ -11,7 +11,7 @@ def copy_upstream_src(wpilib_root: Path):
# Copy header into allwpilib
dest_filename = (
wpiutil / f"src/main/native/thirdparty/argparse/include/wpi/util/argparse.hpp"
wpiutil / "src/main/native/thirdparty/argparse/include/wpi/util/argparse.hpp"
)
shutil.copyfile("include/argparse/argparse.hpp", dest_filename)
# Rename namespace from argparse to wpi

View File

@@ -22,14 +22,15 @@ def copy_upstream_src(wpilib_root: Path):
)
os.chdir(upstream_root / "src")
walk_cwd_and_copy_if(
lambda dp, f: f.endswith(".cpp")
and "catch2" in dp.parts
and f != "catch_main.cpp",
lambda dp, f: (
f.endswith(".cpp") and "catch2" in dp.parts and f != "catch_main.cpp"
),
catch2 / "src/main/native/cpp",
)
walk_cwd_and_copy_if(
lambda dp, f: f.endswith(".hpp")
and ("third_party" in dp.parts or "catch2" in dp.parts),
lambda dp, f: (
f.endswith(".hpp") and ("third_party" in dp.parts or "catch2" in dp.parts)
),
catch2 / "src/main/native/include",
)

View File

@@ -18,9 +18,9 @@ def copy_upstream_src(wpilib_root: Path):
# Copy fmt source files into allwpilib
walk_cwd_and_copy_if(
lambda dp, f: has_prefix(dp, Path("src"))
and f.endswith(".cc")
and f != "fmt.cc",
lambda dp, f: (
has_prefix(dp, Path("src")) and f.endswith(".cc") and f != "fmt.cc"
),
wpiutil / "src/main/native/thirdparty/fmtlib",
)

View File

@@ -32,7 +32,7 @@ def copy_upstream_src(wpilib_root: Path):
return False
src_files = walk_cwd_and_copy_if(
walk_cwd_and_copy_if(
src_filter,
glfw,
)

View File

@@ -27,14 +27,16 @@ def copy_upstream_src(wpilib_root: Path):
shutil.rmtree(third_party_root / d, ignore_errors=True)
walk_cwd_and_copy_if(
lambda dp, f: has_prefix(dp, Path("googlemock/src"))
and f not in EXCLUDED_FILES,
lambda dp, f: (
has_prefix(dp, Path("googlemock/src")) and f not in EXCLUDED_FILES
),
third_party_root / "src",
)
walk_cwd_and_copy_if(
lambda dp, f: has_prefix(dp, Path("googletest/src"))
and f not in EXCLUDED_FILES,
lambda dp, f: (
has_prefix(dp, Path("googletest/src")) and f not in EXCLUDED_FILES
),
third_party_root / "src",
)

View File

@@ -17,28 +17,32 @@ def copy_upstream_src(wpilib_root: Path):
shutil.rmtree(wpical / d, ignore_errors=True)
files = walk_cwd_and_copy_if(
lambda dp, f: (f.endswith(".h") or f.endswith(".hh"))
and not f == "heap.h"
and not f == "stereo-matching-libelas.h"
and not has_prefix(dp, Path("test")),
lambda dp, f: (
(f.endswith(".h") or f.endswith(".hh"))
and not f == "heap.h"
and not f == "stereo-matching-libelas.h"
and not has_prefix(dp, Path("test"))
),
wpical / "src/main/native/thirdparty/mrcal/include",
)
files = files + walk_cwd_and_copy_if(
lambda dp, f: (
f.endswith(".c")
or f.endswith(".cc")
or f.endswith(".cpp")
or f.endswith(".pl")
)
and not f == "heap.cc"
and not f == "mrcal-pywrap.c"
and not f == "image.c"
and not f == "stereo.c"
and not f == "stereo-matching-libelas.cc"
and not f == "uncertainty.c"
and not f == "traverse-sensor-links.c"
and not has_prefix(dp, Path("doc"))
and not has_prefix(dp, Path("test")),
(
f.endswith(".c")
or f.endswith(".cc")
or f.endswith(".cpp")
or f.endswith(".pl")
)
and not f == "heap.cc"
and not f == "mrcal-pywrap.c"
and not f == "image.c"
and not f == "stereo.c"
and not f == "stereo-matching-libelas.cc"
and not f == "uncertainty.c"
and not f == "traverse-sensor-links.c"
and not has_prefix(dp, Path("doc"))
and not has_prefix(dp, Path("test"))
),
wpical / "src/main/native/thirdparty/mrcal/src",
)

View File

@@ -50,7 +50,7 @@ def copy_upstream_src(wpilib_root: Path):
wpiutil / "src/main/native/thirdparty/nanopb/include",
)
generator_files = walk_cwd_and_copy_if(
walk_cwd_and_copy_if(
lambda dp, f: has_prefix(dp, Path("generator")),
wpiutil / "src/main/native/thirdparty/nanopb",
)

View File

@@ -18,7 +18,7 @@ def copy_upstream_src(wpilib_root: Path):
# Copy Sleipnir files into allwpilib
walk_cwd_and_copy_if(
lambda dp, f: (has_prefix(dp, Path("include")) or has_prefix(dp, Path("src"))),
lambda dp, f: has_prefix(dp, Path("include")) or has_prefix(dp, Path("src")),
wpimath / "src/main/native/thirdparty/sleipnir",
)

View File

@@ -40,32 +40,34 @@ def copy_upstream_src(wpilib_root: Path):
os.chdir(upstream_root / "upb")
include_files = walk_cwd_and_copy_if(
lambda dp, f: (
len(dp.parts) >= 1
and (
dp.parts[0] == "base"
or dp.parts[0] == "hash"
or dp.parts[0] == "mem"
or (
dp.parts[0] == "message"
and "compare" not in f
and "promote" not in f
and "accessors_split64" not in f
)
or dp.parts[0] == "mini_descriptor"
or (dp.parts[0] == "mini_table" and "compat" not in f)
or dp.parts[0] == "port"
or dp.parts[0] == "reflection"
or (
dp.parts[0] == "wire"
and "byte_size" not in f
and "decode_fast" not in dp.parts
and "test_util" not in dp.parts
(
len(dp.parts) >= 1
and (
dp.parts[0] == "base"
or dp.parts[0] == "hash"
or dp.parts[0] == "mem"
or (
dp.parts[0] == "message"
and "compare" not in f
and "promote" not in f
and "accessors_split64" not in f
)
or dp.parts[0] == "mini_descriptor"
or (dp.parts[0] == "mini_table" and "compat" not in f)
or dp.parts[0] == "port"
or dp.parts[0] == "reflection"
or (
dp.parts[0] == "wire"
and "byte_size" not in f
and "decode_fast" not in dp.parts
and "test_util" not in dp.parts
)
)
and "cmake" not in dp.parts
)
and "cmake" not in dp.parts
)
and (f.endswith(".h") or f.endswith(".inc"))
or f == "generated_code_support.h",
and (f.endswith(".h") or f.endswith(".inc"))
or f == "generated_code_support.h"
),
wpiutil / "src/main/native/thirdparty/upb/include/upb",
)
for f in include_files:
@@ -75,29 +77,31 @@ def copy_upstream_src(wpilib_root: Path):
walk_cwd_and_copy_if(
lambda dp, f: (
len(dp.parts) >= 1
and (
dp.parts[0] == "base"
or dp.parts[0] == "hash"
or dp.parts[0] == "mem"
or (
dp.parts[0] == "message"
and "compare" not in f
and "promote" not in f
)
or dp.parts[0] == "mini_descriptor"
or (dp.parts[0] == "mini_table" and "compat" not in f)
or dp.parts[0] == "port"
or dp.parts[0] == "reflection"
or (
dp.parts[0] == "wire"
and "byte_size" not in f
and "decode_fast" not in dp.parts
(
len(dp.parts) >= 1
and (
dp.parts[0] == "base"
or dp.parts[0] == "hash"
or dp.parts[0] == "mem"
or (
dp.parts[0] == "message"
and "compare" not in f
and "promote" not in f
)
or dp.parts[0] == "mini_descriptor"
or (dp.parts[0] == "mini_table" and "compat" not in f)
or dp.parts[0] == "port"
or dp.parts[0] == "reflection"
or (
dp.parts[0] == "wire"
and "byte_size" not in f
and "decode_fast" not in dp.parts
)
)
)
)
and f.endswith(".c")
and not f == "descriptor.upb_minitable.c",
and f.endswith(".c")
and not f == "descriptor.upb_minitable.c"
),
wpiutil / "src/main/native/thirdparty/upb/src",
)

17
wpimath/algorithms/ExponentialProfileModel.py Normal file → Executable file
View File

@@ -1,5 +1,18 @@
from sympy import *
from sympy.logic.boolalg import *
#!/usr/bin/env python3
from sympy import (
Eq,
Function,
dsolve,
exp,
expand,
init_printing,
log,
simplify,
solve,
symbols,
)
from sympy.logic.boolalg import SOPform
init_printing()

View File

@@ -256,12 +256,16 @@ UNIT_CONFIGURATIONS = {
"Velocity": {
"base_unit": "unit()",
"generics": {"D": {"extends": "Unit"}},
"multiply": {"Time": {"implementation": inspect.cleandoc("""
"multiply": {
"Time": {
"implementation": inspect.cleandoc("""
@Override
public Measure<D> times(Time multiplier) {
return (Measure<D>) unit().numerator().ofBaseUnits(baseUnitMagnitude() * multiplier.baseUnitMagnitude());
}
""")}},
""")
}
},
"divide": {},
},
"Voltage": {