[bazel] add rules for misc python scripts
There are misc. python scripts used to scramble ROM images, produce ECC
bits for flash images, and generate a version string for ROM. Bazel
rules have been added to properly refer to these scripts with Python
Bazel rules.
Signed-off-by: Timothy Trippel <ttrippel@google.com>
diff --git a/util/rom_chip_info.py b/util/rom_chip_info.py
index 66b1cc0..546cb7d 100755
--- a/util/rom_chip_info.py
+++ b/util/rom_chip_info.py
@@ -7,13 +7,10 @@
import argparse
import logging as log
-import os
import sys
from datetime import datetime
-from io import StringIO
from pathlib import Path
-
header_template = r"""
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
@@ -31,21 +28,20 @@
#endif // _F_CHIPINFO_H__
"""
+
+
def main():
parser = argparse.ArgumentParser(prog="rom_chip_info")
parser.add_argument('--outdir',
'-o',
required=True,
- help='Output Directory'
- )
+ help='Output Directory')
parser.add_argument('--ot_version',
required=False,
- help='OpenTitan Version'
- )
+ help='OpenTitan Version')
parser.add_argument('--ot_version_file',
required=False,
- help='Path to a file with the OpenTitan Version'
- )
+ help='Path to a file with the OpenTitan Version')
log.basicConfig(format="%(levelname)s: %(message)s")
args = parser.parse_args()
@@ -60,8 +56,7 @@
version = open(args.ot_version_file, "rt").read().strip()
else:
log.error(
- "Missing ot_version, provide --ot_version or --ot_version_file."
- )
+ "Missing ot_version, provide --ot_version or --ot_version_file.")
raise SystemExit(sys.exc_info()[1])
outdir = Path(args.outdir)
@@ -72,8 +67,8 @@
now = datetime.now()
wall_time = now.strftime("%Y-%m-%d, %H:%M:%S")
- log.info("Version: %s" % (version,))
- log.info("Build Date: %s" % (wall_time,))
+ log.info("Version: %s" % (version, ))
+ log.info("Build Date: %s" % (wall_time, ))
output = header_template
output = output.replace('{%version%}', version, 1)