[PATCH 12/17] patman: Convert camel case in tout.py
Simon Glass
sjg at chromium.org
Sat Jan 29 22:14:15 CET 2022
Convert this file to snake case and update all files which use it.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
tools/binman/bintool.py | 10 ++---
tools/binman/control.py | 44 +++++++++---------
tools/binman/elf.py | 6 +--
tools/binman/elf_test.py | 4 +-
tools/binman/entry.py | 10 ++---
tools/binman/etype/fmap.py | 2 +-
tools/binman/etype/section.py | 10 ++---
tools/binman/etype/u_boot_spl_expanded.py | 2 +-
tools/binman/etype/u_boot_tpl_expanded.py | 2 +-
tools/binman/ftest.py | 2 +-
tools/binman/image.py | 6 +--
tools/binman/state.py | 16 +++----
tools/patman/status.py | 6 +--
tools/patman/tools.py | 8 ++--
tools/patman/tout.py | 54 +++++++++++------------
15 files changed, 91 insertions(+), 91 deletions(-)
diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index 7a0c8163924..4bc3cfebce5 100644
--- a/tools/binman/bintool.py
+++ b/tools/binman/bintool.py
@@ -267,7 +267,7 @@ class Bintool:
name = os.path.expanduser(self.name) # Expand paths containing ~
all_args = (name,) + args
env = tools.get_env_with_path()
- tout.Detail(f"bintool: {' '.join(all_args)}")
+ tout.detail(f"bintool: {' '.join(all_args)}")
result = command.run_pipe(
[all_args], capture=True, capture_stderr=True, env=env,
raise_on_error=False, binary=binary)
@@ -278,17 +278,17 @@ class Bintool:
# try to run it (as above) since RunPipe() allows faking the tool's
# output
if not any([result.stdout, result.stderr, tools.tool_find(name)]):
- tout.Info(f"bintool '{name}' not found")
+ tout.info(f"bintool '{name}' not found")
return None
if raise_on_error:
- tout.Info(f"bintool '{name}' failed")
+ tout.info(f"bintool '{name}' failed")
raise ValueError("Error %d running '%s': %s" %
(result.return_code, ' '.join(all_args),
result.stderr or result.stdout))
if result.stdout:
- tout.Debug(result.stdout)
+ tout.debug(result.stdout)
if result.stderr:
- tout.Debug(result.stderr)
+ tout.debug(result.stderr)
return result
def run_cmd(self, *args, binary=False):
diff --git a/tools/binman/control.py b/tools/binman/control.py
index 305f14bad31..a179f781298 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -99,9 +99,9 @@ def _ReadMissingBlobHelp():
return result
def _ShowBlobHelp(path, text):
- tout.Warning('\n%s:' % path)
+ tout.warning('\n%s:' % path)
for line in text.splitlines():
- tout.Warning(' %s' % line)
+ tout.warning(' %s' % line)
def _ShowHelpForMissingBlobs(missing_list):
"""Show help for each missing blob to help the user take action
@@ -259,14 +259,14 @@ def ExtractEntries(image_fname, output_fname, outdir, entry_paths,
entry = image.FindEntryPath(entry_paths[0])
data = entry.ReadData(decomp, alt_format)
tools.write_file(output_fname, data)
- tout.Notice("Wrote %#x bytes to file '%s'" % (len(data), output_fname))
+ tout.notice("Wrote %#x bytes to file '%s'" % (len(data), output_fname))
return
# Otherwise we will output to a path given by the entry path of each entry.
# This means that entries will appear in subdirectories if they are part of
# a sub-section.
einfos = image.GetListEntries(entry_paths)[0]
- tout.Notice('%d entries match and will be written' % len(einfos))
+ tout.notice('%d entries match and will be written' % len(einfos))
for einfo in einfos:
entry = einfo.entry
data = entry.ReadData(decomp, alt_format)
@@ -279,7 +279,7 @@ def ExtractEntries(image_fname, output_fname, outdir, entry_paths,
if fname and not os.path.exists(fname):
os.makedirs(fname)
fname = os.path.join(fname, 'root')
- tout.Notice("Write entry '%s' size %x to '%s'" %
+ tout.notice("Write entry '%s' size %x to '%s'" %
(entry.GetPath(), len(data), fname))
tools.write_file(fname, data)
return einfos
@@ -328,7 +328,7 @@ def AfterReplace(image, allow_resize, write_map):
of the entries), False to raise an exception
write_map: True to write a map file
"""
- tout.Info('Processing image')
+ tout.info('Processing image')
ProcessImage(image, update_fdt=True, write_map=write_map,
get_contents=False, allow_resize=allow_resize)
@@ -336,7 +336,7 @@ def AfterReplace(image, allow_resize, write_map):
def WriteEntryToImage(image, entry, data, do_compress=True, allow_resize=True,
write_map=False):
BeforeReplace(image, allow_resize)
- tout.Info('Writing data to %s' % entry.GetPath())
+ tout.info('Writing data to %s' % entry.GetPath())
ReplaceOneEntry(image, entry, data, do_compress, allow_resize)
AfterReplace(image, allow_resize=allow_resize, write_map=write_map)
@@ -361,7 +361,7 @@ def WriteEntry(image_fname, entry_path, data, do_compress=True,
Returns:
Image object that was updated
"""
- tout.Info("Write entry '%s', file '%s'" % (entry_path, image_fname))
+ tout.info("Write entry '%s', file '%s'" % (entry_path, image_fname))
image = Image.FromFile(image_fname)
entry = image.FindEntryPath(entry_path)
WriteEntryToImage(image, entry, data, do_compress=do_compress,
@@ -399,7 +399,7 @@ def ReplaceEntries(image_fname, input_fname, indir, entry_paths,
raise ValueError('Must specify exactly one entry path to write with -f')
entry = image.FindEntryPath(entry_paths[0])
data = tools.read_file(input_fname)
- tout.Notice("Read %#x bytes from file '%s'" % (len(data), input_fname))
+ tout.notice("Read %#x bytes from file '%s'" % (len(data), input_fname))
WriteEntryToImage(image, entry, data, do_compress=do_compress,
allow_resize=allow_resize, write_map=write_map)
return
@@ -408,7 +408,7 @@ def ReplaceEntries(image_fname, input_fname, indir, entry_paths,
# This means that files must appear in subdirectories if they are part of
# a sub-section.
einfos = image.GetListEntries(entry_paths)[0]
- tout.Notice("Replacing %d matching entries in image '%s'" %
+ tout.notice("Replacing %d matching entries in image '%s'" %
(len(einfos), image_fname))
BeforeReplace(image, allow_resize)
@@ -416,19 +416,19 @@ def ReplaceEntries(image_fname, input_fname, indir, entry_paths,
for einfo in einfos:
entry = einfo.entry
if entry.GetEntries():
- tout.Info("Skipping section entry '%s'" % entry.GetPath())
+ tout.info("Skipping section entry '%s'" % entry.GetPath())
continue
path = entry.GetPath()[1:]
fname = os.path.join(indir, path)
if os.path.exists(fname):
- tout.Notice("Write entry '%s' from file '%s'" %
+ tout.notice("Write entry '%s' from file '%s'" %
(entry.GetPath(), fname))
data = tools.read_file(fname)
ReplaceOneEntry(image, entry, data, do_compress, allow_resize)
else:
- tout.Warning("Skipping entry '%s' from missing file '%s'" %
+ tout.warning("Skipping entry '%s' from missing file '%s'" %
(entry.GetPath(), fname))
AfterReplace(image, allow_resize=allow_resize, write_map=write_map)
@@ -488,7 +488,7 @@ def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt, use_expanded):
else:
skip.append(name)
images = new_images
- tout.Notice('Skipping images: %s' % ', '.join(skip))
+ tout.notice('Skipping images: %s' % ', '.join(skip))
state.Prepare(images, dtb)
@@ -574,7 +574,7 @@ def ProcessImage(image, update_fdt, write_map, get_contents=True,
if sizes_ok:
break
image.ResetForPack()
- tout.Info('Pack completed after %d pass(es)' % (pack_pass + 1))
+ tout.info('Pack completed after %d pass(es)' % (pack_pass + 1))
if not sizes_ok:
image.Raise('Entries changed size after packing (tried %s passes)' %
passes)
@@ -585,20 +585,20 @@ def ProcessImage(image, update_fdt, write_map, get_contents=True,
missing_list = []
image.CheckMissing(missing_list)
if missing_list:
- tout.Warning("Image '%s' is missing external blobs and is non-functional: %s" %
+ tout.warning("Image '%s' is missing external blobs and is non-functional: %s" %
(image.name, ' '.join([e.name for e in missing_list])))
_ShowHelpForMissingBlobs(missing_list)
faked_list = []
image.CheckFakedBlobs(faked_list)
if faked_list:
- tout.Warning(
+ tout.warning(
"Image '%s' has faked external blobs and is non-functional: %s" %
(image.name, ' '.join([os.path.basename(e.GetDefaultFilename())
for e in faked_list])))
missing_bintool_list = []
image.check_missing_bintools(missing_bintool_list)
if missing_bintool_list:
- tout.Warning(
+ tout.warning(
"Image '%s' has missing bintools and is non-functional: %s" %
(image.name, ' '.join([os.path.basename(bintool.name)
for bintool in missing_bintool_list])))
@@ -629,7 +629,7 @@ def Binman(args):
if args.cmd in ['ls', 'extract', 'replace', 'tool']:
try:
- tout.Init(args.verbosity)
+ tout.init(args.verbosity)
tools.prepare_output_dir(None)
if args.cmd == 'ls':
ListEntries(args.image, args.paths)
@@ -682,7 +682,7 @@ def Binman(args):
args.indir.append(board_pathname)
try:
- tout.Init(args.verbosity)
+ tout.init(args.verbosity)
elf.debug = args.debug
cbfs_util.VERBOSE = args.verbosity > 2
state.use_fake_dtb = args.fake_dtb
@@ -724,13 +724,13 @@ def Binman(args):
elf.UpdateFile(*elf_params, data)
if invalid:
- tout.Warning("\nSome images are invalid")
+ tout.warning("\nSome images are invalid")
# Use this to debug the time take to pack the image
#state.TimingShow()
finally:
tools.finalise_output_dir()
finally:
- tout.Uninit()
+ tout.uninit()
return 0
diff --git a/tools/binman/elf.py b/tools/binman/elf.py
index 47e0a3f51cc..bc4966e8a84 100644
--- a/tools/binman/elf.py
+++ b/tools/binman/elf.py
@@ -185,7 +185,7 @@ def LookupAndWriteSymbols(elf_fname, entry, section):
value = -1
pack_string = pack_string.lower()
value_bytes = struct.pack(pack_string, value)
- tout.Debug('%s:\n insert %s, offset %x, value %x, length %d' %
+ tout.debug('%s:\n insert %s, offset %x, value %x, length %d' %
(msg, name, offset, value, len(value_bytes)))
entry.data = (entry.data[:offset] + value_bytes +
entry.data[offset + sym.size:])
@@ -350,7 +350,7 @@ def DecodeElf(data, location):
mem_end - data_start)
def UpdateFile(infile, outfile, start_sym, end_sym, insert):
- tout.Notice("Creating file '%s' with data length %#x (%d) between symbols '%s' and '%s'" %
+ tout.notice("Creating file '%s' with data length %#x (%d) between symbols '%s' and '%s'" %
(outfile, len(insert), len(insert), start_sym, end_sym))
syms = GetSymbolFileOffset(infile, [start_sym, end_sym])
if len(syms) != 2:
@@ -368,4 +368,4 @@ def UpdateFile(infile, outfile, start_sym, end_sym, insert):
newdata += insert + tools.get_bytes(0, size - len(insert))
newdata += data[syms[end_sym].offset:]
tools.write_file(outfile, newdata)
- tout.Info('Written to offset %#x' % syms[start_sym].offset)
+ tout.info('Written to offset %#x' % syms[start_sym].offset)
diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index 0f749ee2541..47ebfbac4a6 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -172,7 +172,7 @@ class TestElf(unittest.TestCase):
def testDebug(self):
"""Check that enabling debug in the elf module produced debug output"""
try:
- tout.Init(tout.DEBUG)
+ tout.init(tout.DEBUG)
entry = FakeEntry(20)
section = FakeSection()
elf_fname = self.ElfTestFile('u_boot_binman_syms')
@@ -180,7 +180,7 @@ class TestElf(unittest.TestCase):
syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
self.assertTrue(len(stdout.getvalue()) > 0)
finally:
- tout.Init(tout.WARNING)
+ tout.init(tout.WARNING)
def testMakeElf(self):
"""Test for the MakeElf function"""
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 07a27132880..dc26f8f167b 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -400,7 +400,7 @@ class Entry(object):
data += tools.get_bytes(0, self.contents_size - new_size)
if not size_ok:
- tout.Debug("Entry '%s' size change from %s to %s" % (
+ tout.debug("Entry '%s' size change from %s to %s" % (
self._node.path, to_hex(self.contents_size),
to_hex(new_size)))
self.SetContents(data)
@@ -489,12 +489,12 @@ class Entry(object):
def Info(self, msg):
"""Convenience function to log info referencing a node"""
tag = "Info '%s'" % self._node.path
- tout.Detail('%30s: %s' % (tag, msg))
+ tout.detail('%30s: %s' % (tag, msg))
def Detail(self, msg):
"""Convenience function to log detail referencing a node"""
tag = "Node '%s'" % self._node.path
- tout.Detail('%30s: %s' % (tag, msg))
+ tout.detail('%30s: %s' % (tag, msg))
def GetEntryArgsOrProps(self, props, required=False):
"""Return the values of a set of properties
@@ -841,7 +841,7 @@ features to produce new behaviours.
"""
# Use True here so that we get an uncompressed section to work from,
# although compressed sections are currently not supported
- tout.Debug("ReadChildData section '%s', entry '%s'" %
+ tout.debug("ReadChildData section '%s', entry '%s'" %
(self.section.GetPath(), self.GetPath()))
data = self.section.ReadChildData(self, decomp, alt_format)
return data
@@ -1076,7 +1076,7 @@ features to produce new behaviours.
Returns:
True to use this entry type, False to use the original one
"""
- tout.Info("Node '%s': etype '%s': %s selected" %
+ tout.info("Node '%s': etype '%s': %s selected" %
(node.path, etype, new_etype))
return True
diff --git a/tools/binman/etype/fmap.py b/tools/binman/etype/fmap.py
index 72b44a78693..0c576202a48 100644
--- a/tools/binman/etype/fmap.py
+++ b/tools/binman/etype/fmap.py
@@ -46,7 +46,7 @@ class Entry_fmap(Entry):
"""
def _AddEntries(areas, entry):
entries = entry.GetEntries()
- tout.Debug("fmap: Add entry '%s' type '%s' (%s subentries)" %
+ tout.debug("fmap: Add entry '%s' type '%s' (%s subentries)" %
(entry.GetPath(), entry.etype, to_hex_size(entries)))
if entries and entry.etype != 'cbfs':
# Create an area for the section, which encompasses all entries
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index b3d73023949..706f6bd3e41 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -757,28 +757,28 @@ class Entry_section(Entry):
return self._sort
def ReadData(self, decomp=True, alt_format=None):
- tout.Info("ReadData path='%s'" % self.GetPath())
+ tout.info("ReadData path='%s'" % self.GetPath())
parent_data = self.section.ReadData(True, alt_format)
offset = self.offset - self.section._skip_at_start
data = parent_data[offset:offset + self.size]
- tout.Info(
+ tout.info(
'%s: Reading data from offset %#x-%#x (real %#x), size %#x, got %#x' %
(self.GetPath(), self.offset, self.offset + self.size, offset,
self.size, len(data)))
return data
def ReadChildData(self, child, decomp=True, alt_format=None):
- tout.Debug(f"ReadChildData for child '{child.GetPath()}'")
+ tout.debug(f"ReadChildData for child '{child.GetPath()}'")
parent_data = self.ReadData(True, alt_format)
offset = child.offset - self._skip_at_start
- tout.Debug("Extract for child '%s': offset %#x, skip_at_start %#x, result %#x" %
+ tout.debug("Extract for child '%s': offset %#x, skip_at_start %#x, result %#x" %
(child.GetPath(), child.offset, self._skip_at_start, offset))
data = parent_data[offset:offset + child.size]
if decomp:
indata = data
data = comp_util.decompress(indata, child.compress)
if child.uncomp_size:
- tout.Info("%s: Decompressing data size %#x with algo '%s' to data size %#x" %
+ tout.info("%s: Decompressing data size %#x with algo '%s' to data size %#x" %
(child.GetPath(), len(indata), child.compress,
len(data)))
if alt_format:
diff --git a/tools/binman/etype/u_boot_spl_expanded.py b/tools/binman/etype/u_boot_spl_expanded.py
index 8e138e6a624..319f6708fe6 100644
--- a/tools/binman/etype/u_boot_spl_expanded.py
+++ b/tools/binman/etype/u_boot_spl_expanded.py
@@ -39,7 +39,7 @@ class Entry_u_boot_spl_expanded(Entry_blob_phase):
@classmethod
def UseExpanded(cls, node, etype, new_etype):
val = state.GetEntryArgBool('spl-dtb')
- tout.DoOutput(tout.INFO if val else tout.DETAIL,
+ tout.do_output(tout.INFO if val else tout.DETAIL,
"Node '%s': etype '%s': %s %sselected" %
(node.path, etype, new_etype, '' if val else 'not '))
return val
diff --git a/tools/binman/etype/u_boot_tpl_expanded.py b/tools/binman/etype/u_boot_tpl_expanded.py
index 15cdac46556..55fde3c8e66 100644
--- a/tools/binman/etype/u_boot_tpl_expanded.py
+++ b/tools/binman/etype/u_boot_tpl_expanded.py
@@ -39,7 +39,7 @@ class Entry_u_boot_tpl_expanded(Entry_blob_phase):
@classmethod
def UseExpanded(cls, node, etype, new_etype):
val = state.GetEntryArgBool('tpl-dtb')
- tout.DoOutput(tout.INFO if val else tout.DETAIL,
+ tout.do_output(tout.INFO if val else tout.DETAIL,
"Node '%s': etype '%s': %s %sselected" %
(node.path, etype, new_etype, '' if val else 'not '))
return val
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 768084ed553..4393c1304d9 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -240,7 +240,7 @@ class TestFunctional(unittest.TestCase):
def setUp(self):
# Enable this to turn on debugging output
- # tout.Init(tout.DEBUG)
+ # tout.init(tout.DEBUG)
command.test_result = None
def tearDown(self):
diff --git a/tools/binman/image.py b/tools/binman/image.py
index 1afaa2e4c38..ac0c301d550 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -170,11 +170,11 @@ class Image(section.Entry_section):
def BuildImage(self):
"""Write the image to a file"""
fname = tools.get_output_filename(self._filename)
- tout.Info("Writing image to '%s'" % fname)
+ tout.info("Writing image to '%s'" % fname)
with open(fname, 'wb') as fd:
data = self.GetPaddedData()
fd.write(data)
- tout.Info("Wrote %#x bytes" % len(data))
+ tout.info("Wrote %#x bytes" % len(data))
def WriteMap(self):
"""Write a map of the image to a .map file
@@ -225,7 +225,7 @@ class Image(section.Entry_section):
return entry
def ReadData(self, decomp=True, alt_format=None):
- tout.Debug("Image '%s' ReadData(), size=%#x" %
+ tout.debug("Image '%s' ReadData(), size=%#x" %
(self.GetPath(), len(self._data)))
return self._data
diff --git a/tools/binman/state.py b/tools/binman/state.py
index b27c800126c..8cd8a483182 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -170,16 +170,16 @@ def SetEntryArgs(args):
global entry_args
entry_args = {}
- tout.Debug('Processing entry args:')
+ tout.debug('Processing entry args:')
if args:
for arg in args:
m = re.match('([^=]*)=(.*)', arg)
if not m:
raise ValueError("Invalid entry arguemnt '%s'" % arg)
name, value = m.groups()
- tout.Debug(' %20s = %s' % (name, value))
+ tout.debug(' %20s = %s' % (name, value))
entry_args[name] = value
- tout.Debug('Processing entry args done')
+ tout.debug('Processing entry args done')
def GetEntryArg(name):
"""Get the value of an entry argument
@@ -263,16 +263,16 @@ def PrepareFromLoadedData(image):
"""
global output_fdt_info, main_dtb, fdt_path_prefix
- tout.Info('Preparing device trees')
+ tout.info('Preparing device trees')
output_fdt_info.clear()
fdt_path_prefix = ''
output_fdt_info['fdtmap'] = [image.fdtmap_dtb, 'u-boot.dtb']
main_dtb = None
- tout.Info(" Found device tree type 'fdtmap' '%s'" % image.fdtmap_dtb.name)
+ tout.info(" Found device tree type 'fdtmap' '%s'" % image.fdtmap_dtb.name)
for etype, value in image.GetFdts().items():
entry, fname = value
out_fname = tools.get_output_filename('%s.dtb' % entry.etype)
- tout.Info(" Found device tree type '%s' at '%s' path '%s'" %
+ tout.info(" Found device tree type '%s' at '%s' path '%s'" %
(etype, out_fname, entry.GetPath()))
entry._filename = entry.GetDefaultFilename()
data = entry.ReadData()
@@ -285,7 +285,7 @@ def PrepareFromLoadedData(image):
image_node = dtb.GetNode('/binman/%s' % image.image_node)
fdt_path_prefix = image_node.path
output_fdt_info[etype] = [dtb, None]
- tout.Info(" FDT path prefix '%s'" % fdt_path_prefix)
+ tout.info(" FDT path prefix '%s'" % fdt_path_prefix)
def GetAllFdts():
@@ -384,7 +384,7 @@ def SetInt(node, prop, value, for_repack=False):
for_repack: True is this property is only needed for repacking
"""
for n in GetUpdateNodes(node, for_repack):
- tout.Detail("File %s: Update node '%s' prop '%s' to %#x" %
+ tout.detail("File %s: Update node '%s' prop '%s' to %#x" %
(n.GetFdt().name, n.path, prop, value))
n.SetInt(prop, value)
diff --git a/tools/patman/status.py b/tools/patman/status.py
index f3fbc661b2f..ece6b159d20 100644
--- a/tools/patman/status.py
+++ b/tools/patman/status.py
@@ -245,7 +245,7 @@ def collect_patches(series, series_id, url, rest_api=call_rest_api):
count = len(patch_dict)
num_commits = len(series.commits)
if count != num_commits:
- tout.Warning('Warning: Patchwork reports %d patches, series has %d' %
+ tout.warning('Warning: Patchwork reports %d patches, series has %d' %
(count, num_commits))
patches = []
@@ -257,7 +257,7 @@ def collect_patches(series, series_id, url, rest_api=call_rest_api):
patch.parse_subject(pw_patch['name'])
patches.append(patch)
if warn_count > 1:
- tout.Warning(' (total of %d warnings)' % warn_count)
+ tout.warning(' (total of %d warnings)' % warn_count)
# Sort patches by patch number
patches = sorted(patches, key=lambda x: x.seq)
@@ -437,7 +437,7 @@ def check_patchwork_status(series, series_id, branch, dest_branch, force,
patch_for_commit, _, warnings = compare_with_series(series, patches)
for warn in warnings:
- tout.Warning(warn)
+ tout.warning(warn)
patch_list = [patch_for_commit.get(c) for c in range(len(series.commits))]
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index 35fade0f72c..5e4d4ac05cf 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -64,16 +64,16 @@ def prepare_output_dir(dirname, preserve=False):
except OSError as err:
raise CmdError("Cannot make output directory '%s': '%s'" %
(outdir, err.strerror))
- tout.Debug("Using output directory '%s'" % outdir)
+ tout.debug("Using output directory '%s'" % outdir)
else:
outdir = tempfile.mkdtemp(prefix='binman.')
- tout.Debug("Using temporary directory '%s'" % outdir)
+ tout.debug("Using temporary directory '%s'" % outdir)
def _remove_output_dir():
global outdir
shutil.rmtree(outdir)
- tout.Debug("Deleted temporary directory '%s'" % outdir)
+ tout.debug("Deleted temporary directory '%s'" % outdir)
outdir = None
def finalise_output_dir():
@@ -121,7 +121,7 @@ def set_input_dirs(dirname):
global indir
indir = dirname
- tout.Debug("Using input directories %s" % indir)
+ tout.debug("Using input directories %s" % indir)
def get_input_filename(fname, allow_missing=False):
"""Return a filename for use as input.
diff --git a/tools/patman/tout.py b/tools/patman/tout.py
index 33305263d8e..7eb555aaaea 100644
--- a/tools/patman/tout.py
+++ b/tools/patman/tout.py
@@ -30,10 +30,10 @@ def __enter__():
def __exit__(unused1, unused2, unused3):
"""Clean up and remove any progress message."""
- ClearProgress()
+ clear_progress()
return False
-def UserIsPresent():
+def user_is_present():
"""This returns True if it is likely that a user is present.
Sometimes we want to prompt the user, but if no one is there then this
@@ -44,7 +44,7 @@ def UserIsPresent():
"""
return stdout_is_tty and verbose > 0
-def ClearProgress():
+def clear_progress():
"""Clear any active progress message on the terminal."""
global in_progress
if verbose > 0 and stdout_is_tty and in_progress:
@@ -52,14 +52,14 @@ def ClearProgress():
_stdout.flush()
in_progress = False
-def Progress(msg, warning=False, trailer='...'):
+def progress(msg, warning=False, trailer='...'):
"""Display progress information.
Args:
msg: Message to display.
warning: True if this is a warning."""
global in_progress
- ClearProgress()
+ clear_progress()
if verbose > 0:
_progress = msg + trailer
if stdout_is_tty:
@@ -70,7 +70,7 @@ def Progress(msg, warning=False, trailer='...'):
else:
_stdout.write(_progress + '\n')
-def _Output(level, msg, color=None):
+def _output(level, msg, color=None):
"""Output a message to the terminal.
Args:
@@ -80,7 +80,7 @@ def _Output(level, msg, color=None):
error: True if this is an error message, else False.
"""
if verbose >= level:
- ClearProgress()
+ clear_progress()
if color:
msg = _color.Color(color, msg)
if level < NOTICE:
@@ -88,7 +88,7 @@ def _Output(level, msg, color=None):
else:
print(msg)
-def DoOutput(level, msg):
+def do_output(level, msg):
"""Output a message to the terminal.
Args:
@@ -96,66 +96,66 @@ def DoOutput(level, msg):
this as high as the currently selected level.
msg; Message to display.
"""
- _Output(level, msg)
+ _output(level, msg)
-def Error(msg):
+def error(msg):
"""Display an error message
Args:
msg; Message to display.
"""
- _Output(ERROR, msg, _color.RED)
+ _output(ERROR, msg, _color.RED)
-def Warning(msg):
+def warning(msg):
"""Display a warning message
Args:
msg; Message to display.
"""
- _Output(WARNING, msg, _color.YELLOW)
+ _output(WARNING, msg, _color.YELLOW)
-def Notice(msg):
+def notice(msg):
"""Display an important infomation message
Args:
msg; Message to display.
"""
- _Output(NOTICE, msg)
+ _output(NOTICE, msg)
-def Info(msg):
+def info(msg):
"""Display an infomation message
Args:
msg; Message to display.
"""
- _Output(INFO, msg)
+ _output(INFO, msg)
-def Detail(msg):
+def detail(msg):
"""Display a detailed message
Args:
msg; Message to display.
"""
- _Output(DETAIL, msg)
+ _output(DETAIL, msg)
-def Debug(msg):
+def debug(msg):
"""Display a debug message
Args:
msg; Message to display.
"""
- _Output(DEBUG, msg)
+ _output(DEBUG, msg)
-def UserOutput(msg):
+def user_output(msg):
"""Display a message regardless of the current output level.
This is used when the output was specifically requested by the user.
Args:
msg; Message to display.
"""
- _Output(0, msg)
+ _output(0, msg)
-def Init(_verbose=WARNING, stdout=sys.stdout):
+def init(_verbose=WARNING, stdout=sys.stdout):
"""Initialize a new output object.
Args:
@@ -173,7 +173,7 @@ def Init(_verbose=WARNING, stdout=sys.stdout):
stdout_is_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
stderr_is_tty = hasattr(sys.stderr, 'isatty') and sys.stderr.isatty()
-def Uninit():
- ClearProgress()
+def uninit():
+ clear_progress()
-Init()
+init()
--
2.35.0.rc2.247.g8bbb082509-goog
More information about the U-Boot
mailing list