aboutsummaryrefslogtreecommitdiff
path: root/toolchain_utils_githooks
AgeCommit message (Collapse)Author
2024-04-02check-presubmit: add missing fGeorge Burgess IV
Oops. BUG=b:332589934 TEST=repo upload complained while actually giving me autofix commands Change-Id: Ie4cecccaeb13c325928e6185a1c3be59bef4f787 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5417085 Auto-Submit: George Burgess <gbiv@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: George Burgess <gbiv@chromium.org> Tested-by: George Burgess <gbiv@chromium.org> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
2024-04-02replace shlex.quote with shlex.joinGeorge Burgess IV
shlex.join(list_of_strs) is new in py3.8. It's also a decent bit cleaner than `" ".join(shlex.quote(x) for x in l)`. BUG=None TEST=repo upload Change-Id: Id1f6170bd3364adb6e229bc001ab9c0a182c2123 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5410944 Tested-by: George Burgess <gbiv@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com> Auto-Submit: George Burgess <gbiv@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org>
2024-03-15afdo_tools: add update_kernel_afdo.pyGeorge Burgess IV
The intent is to replace `update_kernel_afdo` with this. BUG=b:329449239 TEST=Ran the script. Example CL this generated for canary: TEST=crrev.com/c/5372145 Change-Id: If5ca0f9055a60b0e7dedacd1c8b76aadc55561f3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5373229 Commit-Queue: George Burgess <gbiv@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Tested-by: George Burgess <gbiv@chromium.org>
2024-03-13toolchain_utils_githooks: add --install_deps_only flagGeorge Burgess IV
This flag is useful if folks who commit to toolchain-utils set up their chroots in some sort of background process. Saves time on `repo upload` since all deps are already installed. BUG=None TEST=Ran the script with --install_deps_only. Change-Id: I4414b16eec313ee6943fb76e559aa0e9a213bc76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5367609 Reviewed-by: Bob Haarman <inglorion@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2023-12-27toolchain_utils_githooks: add script to mypy checksGeorge Burgess IV
mypy helps and this file has no complaints; use it here BUG=b:316172272 TEST=repo upload Change-Id: I80e00df5625b66ffbaf40ec79a923c3d67edd4f0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5120953 Tested-by: George Burgess <gbiv@chromium.org> Auto-Submit: George Burgess <gbiv@chromium.org> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
2023-12-22llvm_tools: opt into static checking for all Python codeBob Haarman
With the previous slew of changes, all Python code in llvm_tools now passes static type checking. Turn on static type checking in presubmit for the entire directory. BUG=b:316360063 TEST=for x in llvm_tools/*.py; do mypy "$x"; done Change-Id: I2082f4fffe9a84c0a39a5feede0110e8fa900ea7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5147574 Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Tested-by: Bob Haarman <inglorion@chromium.org> Commit-Queue: Bob Haarman <inglorion@chromium.org>
2023-12-22cros_utils/tiny_render.py: fix mypy complaintsBob Haarman
BUG=b:316360063 TEST=presubmit Change-Id: Ifc880f86529f689ccda485692cc6a9d9e9469ec5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5147572 Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Tested-by: Bob Haarman <inglorion@chromium.org> Commit-Queue: Bob Haarman <inglorion@chromium.org>
2023-12-22llvm_tools/llvm_project.py: opt into static type checkingBob Haarman
BUG=b:316360063 TEST=presubmit Change-Id: I07e0c13f6fbca30238e947c0f1c99d86953b6abc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5143448 Commit-Queue: Bob Haarman <inglorion@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Tested-by: Bob Haarman <inglorion@chromium.org>
2023-12-21llvm_tools/check_clang_diags.py: fix mypy complaintsBob Haarman
BUG=b:316360063 TEST=presubmit Change-Id: Iad624d33d2e4af1486af5d901c1c419f885e8f9c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5147568 Tested-by: Bob Haarman <inglorion@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Bob Haarman <inglorion@chromium.org>
2023-12-21cros_utils/bugs.py: fix type annotations and opt into static checkingBob Haarman
BUG=b:316360063 TEST=presubmit Change-Id: I45cf29d8ee87eb334db26a5bab1b500166525282 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5148169 Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Bob Haarman <inglorion@chromium.org> Tested-by: Bob Haarman <inglorion@chromium.org>
2023-12-21llvm_tools/modify_a_tryjob.py: opt into static type checkingBob Haarman
BUG=b:316360063 TEST=presubmit Change-Id: I691e90c4b8577ee79516c0f009de17777bf72059 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5148167 Tested-by: Bob Haarman <inglorion@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Bob Haarman <inglorion@chromium.org>
2023-12-21llvm_tools/update_packages_and_run_tests.py: add type annotationsBob Haarman
Adds type annotations to llvm_tools/update_packages_and_run_tests.py and adds it and its test to the list of Python files we statically typecheck in presubmit. BUG=b:316360063 TEST=presubmit Change-Id: I0ff047c2da18ce1ab570f6d47cc88b4801e182b7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5145907 Tested-by: Bob Haarman <inglorion@chromium.org> Commit-Queue: Bob Haarman <inglorion@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
2023-12-21llvm_tools/update_chromeos_llvm_hash.py: fix type errors and unit testBob Haarman
BUG=b:316360063 TEST=presubmit Change-Id: Ieeab8003dbec8f25753821c44a91f26ce3ad5f6f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5143451 Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Tested-by: Bob Haarman <inglorion@chromium.org> Commit-Queue: Bob Haarman <inglorion@chromium.org>
2023-12-21llvm_tools/manifest_utils.py: opt into static type checkingBob Haarman
BUG=b:316360063 TEST=presubmit Change-Id: I2c2483a8d611bbbd922ba3c009418d6bde4d8bc5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5143286 Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Bob Haarman <inglorion@chromium.org> Tested-by: Bob Haarman <inglorion@chromium.org>
2023-12-21llvm_tools/patch_{manager,utils}.py: opt into static type checkingBob Haarman
BUG=b:316360063 TEST=presubmit Change-Id: Icd70660630fd53be002fa934a897a91370fcc0df Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5143446 Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Bob Haarman <inglorion@chromium.org> Tested-by: Bob Haarman <inglorion@chromium.org>
2023-12-21llvm_tools/get_llvm_hash.py: annotate and opt into static type checkingBob Haarman
BUG=b:316360063 TEST=presubmit Change-Id: I5e6fe473465293fd8c1e67e6ff5199c55731abae Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5143107 Tested-by: Bob Haarman <inglorion@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Bob Haarman <inglorion@chromium.org>
2023-12-21llvm_tools/git.py: opt into static type checkingBob Haarman
This adds type annotations to git.py and opts it and git_unittest.py into static type checking on presubmit. BUG=b:316360063 TEST=presubmit Change-Id: I70c71c602315308a5a5c0930156e62a674b3c6bf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5144188 Tested-by: Bob Haarman <inglorion@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Bob Haarman <inglorion@chromium.org>
2023-12-21llvm_tools/atomic_write_file.py: fix type annotation errorsBob Haarman
This changes the signature of atomic_write to only take an optional encoding argument instead of the previous *args and **kwargs. It turns out that encoding is the only argument we actually pass. BUG=b:316360063 TEST=mypy llvm_tools/atomic_write_file.py Change-Id: I2adf7f265809fa283253e6fd2985c8099728b162 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5143106 Commit-Queue: Bob Haarman <inglorion@chromium.org> Tested-by: Bob Haarman <inglorion@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
2023-12-19llvm_tools/git_llvm_rev.py: opt into static type checkingBob Haarman
This opts llvm_tools/git_llvm_rev.py and llvm_tools/git_llvm_rev_test.py into static type checking and fixes a few mypy complaints. BUG=b:316360063 TEST=presubmit Change-Id: Ic639fccbe7730ec16d7d431260020906e07003c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5123271 Commit-Queue: Bob Haarman <inglorion@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Tested-by: Bob Haarman <inglorion@chromium.org>
2023-12-14llvm_tools/chroot: add type annotations and opt into static checkingBob Haarman
This opts llvm_tools/chroot.py into static type checking and adds some previously missing type annotations. BUG=b:316360063 TEST=presubmit Change-Id: Ica55b1cfa7c985128372de2cba4116513dcc205c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5116291 Reviewed-by: Ryan Beltran <ryanbeltran@chromium.org> Tested-by: Bob Haarman <inglorion@chromium.org> Commit-Queue: Bob Haarman <inglorion@chromium.org>
2023-12-04check-presubmit: use mypy to check everything in rust_toolsGeorge Burgess IV
BUG=b:314767343 TEST=./check-presubmit.py Change-Id: I46d5763f0c3fb36af02f15983354d1e866ecde2a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5084478 Tested-by: George Burgess <gbiv@chromium.org> Reviewed-by: Bob Haarman <inglorion@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org>
2023-11-07llvm_tools: add revert report generationGeorge Burgess IV
The test matrix requests notes on reverts that have and haven't been applied to llvm-next. This is kind of annoying to figure out manually, since it's a bunch of SHA matching. BUG=b:305000636 TEST=Ran the script Change-Id: Ic1793414083a126b700e1fedc9a1101c5d9bb047 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5010081 Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: George Burgess <gbiv@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2023-11-06check-presubmit: move `get_from_pip` under `get_pip` checkGeorge Burgess IV
mypy was complaining about the `pip + ["show", "mypy"]` here, since `pip`'s inferred type is `Optional[_]`. Moving this function's definition below the `if not pip` check assures `mypy` that this function is only ever called if `pip` has a value. BUG=b:308443233 TEST=repo upload Change-Id: Iecef039d64bc5102d4d4171e85d39914119df1e0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4989913 Commit-Queue: George Burgess <gbiv@chromium.org> Tested-by: George Burgess <gbiv@chromium.org> Reviewed-by: Bob Haarman <inglorion@chromium.org>
2023-11-06check-presubmit: put cros_utils on PYTHONPATHGeorge Burgess IV
We do this already for `cros lint`; make sure it's done here, so mypy can reason about types more accurately. BUG=b:308443233 TEST=repo upload Change-Id: Ia0273404934b0846c4ec63927928a7b39afc50cc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4989912 Commit-Queue: George Burgess <gbiv@chromium.org> Reviewed-by: Bob Haarman <inglorion@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2023-11-06check-presubmit: silence mypy on imported modulesGeorge Burgess IV
If this isn't done, mypy will typecheck all modules transitively imported by the file(s) that it's asked to inspect. This can lead to many warnings that the CL in question has no obligation to clean up. BUG=b:308443233 TEST=repo upload Change-Id: I5fa29718c7a16b21364d1e2dc9221cb9e0ac6663 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4989911 Reviewed-by: Bob Haarman <inglorion@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2023-10-09check-presubmit.py: support directories in mypy allowlistGeorge Burgess IV
pgo_tools should ideally all be mypy-compliant. BUG=b:298247335 TEST=Ran preupload hooks Change-Id: If44b142abcd9beae2337e66a59f164d8a849e60f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4883423 Commit-Queue: George Burgess <gbiv@chromium.org> Tested-by: George Burgess <gbiv@chromium.org> Reviewed-by: Bob Haarman <inglorion@chromium.org>
2023-10-07check-presubmit: complain about changes to compiler_wrapperGeorge Burgess IV
Users should no longer make changes here; complain about them if someone does. People can always bypass this hook (& automation will be instructed to), so hard failing unconditionally on these changes works nicely here. While I'm in the area, modernize the code a bit. BUG=b:293171405 TEST=repo upload with & without compiler_wrapper changes Cq-Depend: chromium:4915988 Change-Id: I5c6731c521fee559a201533a6d3651d3acd4a08f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4916842 Reviewed-by: Ryan Beltran <ryanbeltran@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2023-08-30githooks: import typenames instead of "import typing as t"Bob Haarman
Historically, check-presubmit.py has used "import typing as t". Elsewhere, we use "from typing import List" (etc. for other types). This changes check-presubmit.py style to be consistent with how we do things elsewhere. BUG=b:297584575 TEST=run presubmit (which also checks types) Change-Id: I3934c9f595585552bec164bc1c5a67d42ac4389a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4823031 Commit-Queue: Bob Haarman <inglorion@chromium.org> Tested-by: Bob Haarman <inglorion@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org>
2023-08-28githooks: fix type errorsBob Haarman
check-presubmit.py now checks for type errors in selected Python files. This change makes check-presubmit.py itself pass those checks, and adds it to the list of files to be checked in presubmit. BUG=b:297584575 TEST=presubmit Change-Id: I9c803ac7a08f4fa1331ca9974414aa753e81dbc6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4818707 Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Tested-by: Bob Haarman <inglorion@chromium.org> Commit-Queue: Bob Haarman <inglorion@chromium.org>
2023-08-25githooks: add Python type checking using mypyBob Haarman
This makes the presubmit hook run mypy on a list of files in the repository if they are given on the command line. For now, the list contains only pgo_tools_rust/pgo_rust.py and rust_tools/rust_uprev.py. These files currently pass mypy's checks, and running the checks as part of presubmit should ensure they keep passing. BUG=None TEST=ran the hook on code with and without type errors Change-Id: I93b311033b8d2ad5d66353d74f21dbc756d1ad68 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4776073 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Bob Haarman <inglorion@chromium.org> Reviewed-by: Ryan Beltran <ryanbeltran@chromium.org> Commit-Queue: Bob Haarman <inglorion@chromium.org>
2023-08-17toolchain_utils_githooks: rewrite pip installation logicGeorge Burgess IV
The pip ebuild was removed; we should therefore use python's built-in `pip` module now. BUG=b:296222644, b:296092850 TEST=repo upload Change-Id: I204a03da0fdb703759ed2287a0cf1bc9ca820262 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4789380 Auto-Submit: George Burgess <gbiv@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: George Burgess <gbiv@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2023-08-14githooks: remove USE_PYTHON3 = TrueBob Haarman
We should no longer need USE_PYTHON3 = True, so let's clean up a bit and remove it. BUG=chromium:1401441 TEST=None Change-Id: I396c7a14ff5ee2b43b5a961f02c20b92ef4b1032 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4776070 Commit-Queue: Bob Haarman <inglorion@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Bob Haarman <inglorion@chromium.org>
2023-08-14githooks: shorten too-long linesBob Haarman
Several lines were reported as exceeding the 80-character limit. This shortens them. BUG=None TEST=None Change-Id: I3ecd16eb637cc699991841f9f92c56eab21e608d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4778621 Commit-Queue: Bob Haarman <inglorion@chromium.org> Tested-by: Bob Haarman <inglorion@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org>
2023-06-05toolchain_utils_githooks: Remove dependenciesJordan R Abrahams-Whitehead
The last remaining dependency was scipy, which we can no longer install. However, we still need to install numpy to conduct linear algebra operations. Presubmits still fail for most files, but these failures are all from cros lint, which we historically have not kept too clean. BUG=b:284489250 TEST=check-presubmit.py llvm_tools/*, checked no dependency errors Change-Id: Ib9e080021a151d130edc93347cec7ab5f676cdb1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4585446 Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Reviewed-by: George Burgess <gbiv@chromium.org> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
2023-04-20githooks: remove all mentions of yapfGeorge Burgess IV
We swapped to `black` for formatting a while ago. BUG=b:279033962 TEST=repo upload Change-Id: I51e4a2a03f03f3ae8fb87df6dd7bcb51d8e83591 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4454909 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org>
2022-12-16presubmits: add USE_PYTHON3 tagGeorge Burgess IV
Apparently some of the py2 detection being done doesn't account for #!s. Add this line so the tooling realizes this is python3. BUG=chromium:1401441 TEST=None Change-Id: I1931f7518e02a1b2bc401525007b6051e5994269 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4114320 Commit-Queue: George Burgess <gbiv@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org> Auto-Submit: George Burgess <gbiv@chromium.org>
2022-10-15toolchain_utils_githooks: Add line-length to blackJordan R Abrahams-Whitehead
This fixes the autofix command so that we enforce a line length of 80 chars. BUG=None TEST=Checked presubmit on violating file Change-Id: If8817cdf9ab70d5d9e5db10c0818207f976f519c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3958135 Reviewed-by: George Burgess <gbiv@chromium.org> Auto-Submit: Jordan Abrahams-Whitehead <ajordanr@google.com> Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
2022-09-13Update license boilerplate text in source code filesMike Frysinger
Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icb42e5012a87920c2cd13b666fb3e55e7e4fb3b8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3891080 Auto-Submit: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org>
2022-09-07check-presubmit: use subprocess.runGeorge Burgess IV
Fixing feedback from crrev.com/c/3877334, which isn't strictly related to that change, but is still useful to clean up BUG=None TEST=`repo upload` Change-Id: I1e183e174cc99dc9e309cc53fbde9f545eb8536f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3877525 Tested-by: George Burgess <gbiv@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
2022-09-07Autoformat all Python codeGeorge Burgess IV
This autoformats all Python code with our new Python formatter, `black`. BUG=b:244644217 TEST=None Change-Id: I15ee49233d98fb6295c0c53c129bbf8e78e0d9ff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3877337 Tested-by: George Burgess <gbiv@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: George Burgess <gbiv@chromium.org>
2022-09-07check-presubmit: add support for the new python formatter, blackGeorge Burgess IV
This is redundant with the `check_black:` flag that we could add to our `PRESUBMIT.cfg`, but `check_black` doesn't offer to autofix formatting. BUG=b:244644217 TEST=Ran the presubmit on this python file. It failed. :) Change-Id: Ie1d392e430ca64c3136eb2d6ab0ed62c550104dc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3877334 Tested-by: George Burgess <gbiv@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Reviewed-by: Ryan Beltran <ryanbeltran@chromium.org>
2022-05-10check-presubmit: use `isort` with `yapf`George Burgess IV
This requires a few things: - Running `isort` to begin with - Syncing with Chromite's `yapf` config, so `yapf` and `isort` don't disagree - ...Which itself requires upgrading `yapf`, since these disagree with `yapf`'s current configuration in toolchain-utils. The most recent chromite configuration requires v0.31.0, and depot_tools only has v0.27.0. This CL does all of these. BUG=b:231985625 TEST=Ran on a few files in toolchain-utils Change-Id: I43414abea7b75790b129e78708903ed90dae6ab0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3636138 Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: George Burgess <gbiv@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2022-04-21toolchain_utils: s/Cr OS/CrOS/gGeorge Burgess IV
Result of running `sed -ri 's/Chrom(ium|e) OS/Chrom\1OS/g' $(find -type f)`. BUG=None TEST=None Change-Id: I59be92537aa19bc989f52b585e307e76dbde401b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3600147 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2021-04-12PRESUBMIT.cfg: drop --py3 to cros lintMike Frysinger
This is the default now. BUG=chromium:1006448 TEST=CQ passes Change-Id: I02dbbd47e35ad0a58da47fa94ef2e192e21cfcb8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2743738 Tested-by: Mike Frysinger <vapier@chromium.org> Auto-Submit: Mike Frysinger <vapier@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org>
2020-06-30presubmits: respect CHROMEOS_ROOT_DIRECTORY when entering the chrootGeorge Burgess IV
BUG=chromium:1100659 TEST=Ran presubmits inside of the CrOS tree, and outside with CHROMEOS_ROOT_DIRECTORY set. Change-Id: I119d13f8f7b6b0f8a1c94750fe5e90be5ad952be Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2274728 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Caroline Tice <cmtice@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-06-30presubmits: add types to check-presubmit.py.George Burgess IV
Since presubmits handle py3 gracefully now && we're starting to add types in many places, it seems worth it to add these for better understandability in the future. No functional change is intended. BUG=chromium:1100659 TEST=Ran the presubmits. Change-Id: If4134b4d10b0f3692a52803e12c8e503b4574be5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2274727 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-05-13githooks: ensure pip + scipy are installedGeorge Burgess IV
Now that we always enter the chroot for presubmits, we might try to run tests in a world where we run `crosperf` tests without `numpy` or `scipy` installed. There's probably a better solution here (this one is kinda bad because presubmits are 'quiet' until we fail, and all of this setup can take up to a minute), but until we find that, stop the bleeding (aka people doing `--no-verify`) BUG=chromium:980719 TEST=Ran crosperf tests with a fresh chroot. Change-Id: I71275f6be0e38bf086b14d35b8bc4bfffcd7ab18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2199644 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-05-05githooks: enter the chroot in presubmitsGeorge Burgess IV
In general, running tests is likely best done in a consistent environment. The more pressing concern here is that depot_tools doesn't fully support python3 yet, so things like our `yapf` check always fail outside of the chroot, if they happen to pick up on depot_tools' yapf. BUG=chromium:1030828 TEST=Ran presubmits on files with type annotations. They now work inside or outside of the chroot. Change-Id: If22a3766e01ea26ebc9e78bc4b40d90ad5d49049 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2182163 Reviewed-by: Tiancong Wang <tcwang@google.com> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
2020-02-13toolchain-utils: migrate all in-use projects to python 3Zhizhou Yang
This patch migrates all in-use projects left to python 3. BUG=chromium:1011676 TEST=Passed unittests and launched scripts manually. Change-Id: I7f2de4e1131c05bacfac80667f3064da8adaebfd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2051397 Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Zhizhou Yang <zhizhouy@google.com> Auto-Submit: Zhizhou Yang <zhizhouy@google.com>
2019-11-09githooks: overhaul presubmit checks; automatically apply fixesGeorge Burgess IV
This CL rewrites our githooks in Python, since bash makes this moderately ugly. The Killer Feature(TM) here is that we now also try to execute the commands that we recommend the user to run. This makes fixing many "yapf disagrees with you" / "you're missing a #!"-style messages as simple as `git commit --amend -a`. Note that these fixes are only auto-applied if your current repo is clean. BUG=None TEST=Various broken and configs in and outside of the chroot. I was also able to `repo upload` with it. :) Change-Id: Id841fa02271c0d03debbf35681eba8151074672e Reviewed-on: https://chromium-review.googlesource.com/1897253 Tested-by: George Burgess <gbiv@chromium.org> Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Denis Nikitin <denik@chromium.org>