pw_env_setup: Get buildifier from CIPD
Also assume it's present in pw_presubmit.
Bug: 191
Change-Id: I7cf5b8b00f4b7ffa94da0d82d47c9306d2cba866
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/57346
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Keir Mierle <keir@google.com>
diff --git a/pw_env_setup/py/pw_env_setup/cipd_setup/pigweed.json b/pw_env_setup/py/pw_env_setup/cipd_setup/pigweed.json
index 3c1c2cc..b6fdd7c 100644
--- a/pw_env_setup/py/pw_env_setup/cipd_setup/pigweed.json
+++ b/pw_env_setup/py/pw_env_setup/cipd_setup/pigweed.json
@@ -181,5 +181,16 @@
"tags": [
"version:2@renode-1.11.0+20210306gite7897c1"
]
+ },
+ {
+ "path": "infra/3pp/tools/buildifier/${platform}",
+ "platforms": [
+ "linux-amd64",
+ "mac-amd64",
+ "windows-amd64"
+ ],
+ "tags": [
+ "version:2@4.0.1"
+ ]
}
]
diff --git a/pw_presubmit/py/pw_presubmit/format_code.py b/pw_presubmit/py/pw_presubmit/format_code.py
index 5f65c2c..fc162c0 100755
--- a/pw_presubmit/py/pw_presubmit/format_code.py
+++ b/pw_presubmit/py/pw_presubmit/format_code.py
@@ -26,7 +26,6 @@
import os
from pathlib import Path
import re
-import shutil
import subprocess
import sys
import tempfile
@@ -133,10 +132,6 @@
def check_bazel_format(files: Iterable[Path]) -> Dict[Path, str]:
"""Checks formatting; returns {path: diff} for files with bad formatting."""
- # TODO(pwbug/191): Get buildifier from CIPD and remove this check.
- if not shutil.which("buildifier"):
- return check_trailing_space(files)
-
def _format_temp(path: Union[Path, str], data: bytes) -> bytes:
# buildifier doesn't have an option to output the changed file, so
# copy the file to a temp location, run buildifier on it, read that
@@ -152,11 +147,6 @@
def fix_bazel_format(files: Iterable[Path]) -> None:
"""Fixes formatting for the provided files in place."""
- # TODO(pwbug/191): Get buildifier from CIPD and remove this check.
- if not shutil.which("buildifier"):
- fix_trailing_space(files)
- return
-
log_run(['buildifier', *files], check=True)