summaryrefslogtreecommitdiff
path: root/firmware_builder.py
diff options
context:
space:
mode:
authorJeremy Bettis <jbettis@google.com>2022-07-12 17:16:48 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-14 19:55:11 +0000
commit56d045e6d7af9bb93a8a7389e37b1410c48a1283 (patch)
tree594619b25762e2b06b7a7ba2174230e7e4e2ce37 /firmware_builder.py
parent1225fa58f96396781e6895bce2dc3e80d86d0f1c (diff)
downloadchrome-ec-56d045e6d7af9bb93a8a7389e37b1410c48a1283.tar.gz
py: Fix pylint errors discovered by cros lint
Resolve all pylint warnings in these files. Disable fixme and too-many-arguments globally, because they are very common, and aren't really problems. BRANCH=None BUG=b:238434058 TEST=cros lint Change-Id: I94c410330d6d576d3cc9518503699a514a28758d Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3760093 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'firmware_builder.py')
-rwxr-xr-xfirmware_builder.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/firmware_builder.py b/firmware_builder.py
index 6c74bf8409..1a8f52df56 100755
--- a/firmware_builder.py
+++ b/firmware_builder.py
@@ -65,8 +65,8 @@ def build(opts):
"When --code-coverage is selected, 'build' is a no-op. "
"Run 'test' with --code-coverage instead."
)
- with open(opts.metrics, "w") as f:
- f.write(json_format.MessageToJson(metric_list))
+ with open(opts.metrics, "w") as file:
+ file.write(json_format.MessageToJson(metric_list))
return
ec_dir = pathlib.Path(__file__).parent
@@ -90,8 +90,8 @@ def build(opts):
)
if memsize_file.exists():
parse_memsize(memsize_file, metric, variant)
- with open(opts.metrics, "w") as f:
- f.write(json_format.MessageToJson(metric_list))
+ with open(opts.metrics, "w") as file:
+ file.write(json_format.MessageToJson(metric_list))
# Ensure that there are no regressions for boards that build successfully
# with clang: b/172020503.
@@ -109,6 +109,7 @@ UNITS = {
def parse_memsize(filename, metric, variant):
+ """Parse the output of the build to extract the image size."""
with open(filename, "r") as infile:
# Skip header line
infile.readline()
@@ -122,6 +123,7 @@ def parse_memsize(filename, metric, variant):
def bundle(opts):
+ """Bundle the artifacts."""
if opts.code_coverage:
bundle_coverage(opts)
else:
@@ -147,8 +149,8 @@ def write_metadata(opts, info):
bundle_metadata_file = (
opts.metadata if opts.metadata else DEFAULT_BUNDLE_METADATA_FILE
)
- with open(bundle_metadata_file, "w") as f:
- f.write(json_format.MessageToJson(info))
+ with open(bundle_metadata_file, "w") as file:
+ file.write(json_format.MessageToJson(info))
def bundle_coverage(opts):
@@ -207,8 +209,8 @@ def test(opts):
"""Runs all of the unit tests for EC firmware"""
# TODO(b/169178847): Add appropriate metric information
metrics = firmware_pb2.FwTestMetricList()
- with open(opts.metrics, "w") as f:
- f.write(json_format.MessageToJson(metrics))
+ with open(opts.metrics, "w") as file:
+ file.write(json_format.MessageToJson(metrics))
# Run python unit tests.
subprocess.run(
@@ -266,6 +268,7 @@ def main(args):
def parse_args(args):
+ """Parse all command line args and return opts dict."""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(