[upstream_utils] Clean up package imports (#6857)

This commit is contained in:
Tyler Veness
2024-07-20 07:01:06 -07:00
committed by GitHub
parent 6ec8763eac
commit d827c84c5e
17 changed files with 16 additions and 86 deletions

View File

@@ -27,7 +27,7 @@ jobs:
with:
python-version: '3.10'
- name: Install wpiformat
run: pip3 install wpiformat==2024.34
run: pip3 install wpiformat==2024.38
- name: Run
run: wpiformat
- name: Check output
@@ -66,7 +66,7 @@ jobs:
with:
python-version: '3.10'
- name: Install wpiformat
run: pip3 install wpiformat==2024.34
run: pip3 install wpiformat==2024.38
- name: Create compile_commands.json
run: |
./gradlew generateCompileCommands -Ptoolchain-optional-roboRio

View File

@@ -21,7 +21,6 @@ import json
import os
from wpimath import geometry, units
import numpy as np
def main():

View File

@@ -3,10 +3,8 @@ import argparse
import json
import sys
from pathlib import Path
from typing import Dict, Any
from jinja2 import Environment, FileSystemLoader
from jinja2.environment import Template
def Output(output_dir: Path, controller_name: str, contents: str):

View File

@@ -130,6 +130,7 @@ def main():
name = "eigen"
url = "https://gitlab.com/libeigen/eigen.git"
tag = "c4d84dfddc9f9edef0fdbe7cf9966d2f4a303198"
patch_list = [
"0001-Disable-warnings.patch",
"0002-Intellisense-fix.patch",

View File

@@ -1,17 +1,9 @@
#!/usr/bin/env python3
import os
import re
import shutil
from upstream_utils import (
get_repo_root,
clone_repo,
comment_out_invalid_includes,
walk_cwd_and_copy_if,
git_am,
Lib,
)
from upstream_utils import Lib
def copy_upstream_src(wpilib_root):

View File

@@ -4,11 +4,7 @@ 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,
)
@@ -24,26 +20,17 @@ def copy_upstream_src(wpilib_root):
shutil.rmtree(os.path.join(wpiutil, d), ignore_errors=True)
# Copy fmt source files into allwpilib
src_files = walk_cwd_and_copy_if(
walk_cwd_and_copy_if(
lambda dp, f: dp.startswith("./src") and f.endswith(".cc") and f != "fmt.cc",
os.path.join(wpiutil, "src/main/native/thirdparty/fmtlib"),
)
# Copy fmt header files into allwpilib
include_files = walk_cwd_and_copy_if(
walk_cwd_and_copy_if(
lambda dp, f: dp.startswith("./include/fmt"),
os.path.join(wpiutil, "src/main/native/thirdparty/fmtlib"),
)
for f in src_files:
comment_out_invalid_includes(
f, [os.path.join(wpiutil, "src/main/native/thirdparty/fmtlib/include")]
)
for f in include_files:
comment_out_invalid_includes(
f, [os.path.join(wpiutil, "src/main/native/thirdparty/fmtlib/include")]
)
def main():
name = "fmt"

View File

@@ -4,11 +4,7 @@ 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,
)
@@ -23,16 +19,11 @@ def copy_upstream_src(wpilib_root):
shutil.rmtree(os.path.join(wpimath, d), ignore_errors=True)
# Copy gcem include files into allwpilib
include_files = walk_cwd_and_copy_if(
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"

View File

@@ -69,9 +69,7 @@ def main():
url = "https://github.com/google/googletest.git"
tag = "v1.14.0"
patch_list = []
googletest = Lib(name, url, tag, patch_list, copy_upstream_src)
googletest = Lib(name, url, tag, [], copy_upstream_src)
googletest.main()

View File

@@ -4,10 +4,7 @@ import os
import shutil
from upstream_utils import (
get_repo_root,
clone_repo,
walk_if,
git_am,
Lib,
)

View File

@@ -4,11 +4,7 @@ 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,
)
@@ -27,7 +23,7 @@ def copy_upstream_src(wpilib_root):
"sunos.h",
]
include_files = walk_cwd_and_copy_if(
walk_cwd_and_copy_if(
lambda dp, f: dp.startswith("./include") and f not in include_ignorelist,
os.path.join(wpinet, "src/main/native/thirdparty/libuv"),
)
@@ -48,7 +44,7 @@ def copy_upstream_src(wpilib_root):
"sysinfo-loadavg.c",
"sysinfo-memory.c",
]
src_files = walk_cwd_and_copy_if(
walk_cwd_and_copy_if(
lambda dp, f: dp.startswith("./src") and f not in src_ignorelist,
os.path.join(wpinet, "src/main/native/thirdparty/libuv"),
rename_c_to_cpp=True,

View File

@@ -3,14 +3,7 @@
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,
)
from upstream_utils import Lib
def run_global_replacements(wpiutil_llvm_files):

View File

@@ -4,9 +4,6 @@ import os
import shutil
from upstream_utils import (
get_repo_root,
clone_repo,
comment_out_invalid_includes,
walk_if,
copy_to,
Lib,

View File

@@ -5,10 +5,7 @@ import shutil
import subprocess
from upstream_utils import (
get_repo_root,
clone_repo,
walk_cwd_and_copy_if,
git_am,
Lib,
)

View File

@@ -4,13 +4,8 @@ import os
import shutil
from upstream_utils import (
get_repo_root,
clone_repo,
comment_out_invalid_includes,
copy_to,
walk_cwd_and_copy_if,
walk_if,
git_am,
Lib,
)

View File

@@ -4,11 +4,7 @@ import os
import shutil
from upstream_utils import (
get_repo_root,
clone_repo,
copy_to,
walk_cwd_and_copy_if,
git_am,
Lib,
)

View File

@@ -4,14 +4,7 @@ import os
import shutil
import subprocess
from upstream_utils import (
get_repo_root,
clone_repo,
comment_out_invalid_includes,
walk_cwd_and_copy_if,
git_am,
Lib,
)
from upstream_utils import Lib
def crlf_to_lf():

View File

@@ -287,7 +287,7 @@ if __name__ == "__main__":
if data.entry in entries:
print("...DUPLICATE entry ID, overriding")
entries[data.entry] = data
except TypeError as e:
except TypeError:
print("Start(INVALID)")
elif record.isFinish():
try:
@@ -297,7 +297,7 @@ if __name__ == "__main__":
print("...ID not found")
else:
del entries[entry]
except TypeError as e:
except TypeError:
print("Finish(INVALID)")
elif record.isSetMetadata():
try:
@@ -305,7 +305,7 @@ if __name__ == "__main__":
print(f"SetMetadata({data.entry}, '{data.metadata}') [{timestamp}]")
if data.entry not in entries:
print("...ID not found")
except TypeError as e:
except TypeError:
print("SetMetadata(INVALID)")
elif record.isControl():
print("Unrecognized control record")
@@ -349,5 +349,5 @@ if __name__ == "__main__":
elif entry.type == "string[]":
arr = record.getStringArray()
print(f" {arr}")
except TypeError as e:
except TypeError:
print(" invalid")