Introduce printw() to print warnings. For now there are no logical change, we only call print().
Cc: Bob Feng <bob.c.f...@intel.com> Cc: Liming Gao <liming....@intel.com> Signed-off-by: Philippe Mathieu-Daude <phi...@redhat.com> --- BaseTools/Scripts/PatchCheck.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py index fc1b077f3c64..5692f6eaf8bd 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -28,6 +28,10 @@ def run_git(*args): Result = p.communicate() return Result[0].decode('utf-8', 'ignore') if Result[0] and Result[0].find(b"fatal") !=0 else None +def printw(line): + """Print a warning to the console.""" + print(line) + class Verbose: SILENT, QUIET, ONELINE, NORMAL = range(4) level = NORMAL @@ -67,14 +71,14 @@ class CommitMessageCheck: def error(self, *err): if self.ok and Verbose.level >= Verbose.QUIET: - print('The commit message format is not valid:') + printw('The commit message format is not valid:') self.ok = False if Verbose.level in [Verbose.SILENT, Verbose.ONELINE]: return count = 0 for line in err: prefix = (' *', ' ')[count > 0] - print(prefix, line) + printw("{}{}".format(prefix, line)) count += 1 # Find 'contributed-under:' at the start of a line ignoring case and @@ -415,14 +419,14 @@ class GitDiffCheck: def error(self, *err): if self.ok and Verbose.level >= Verbose.QUIET: - print('Code format is not valid:') + printw('Code format is not valid:') self.ok = False if Verbose.level in [Verbose.SILENT, Verbose.ONELINE]: return count = 0 for line in err: prefix = (' *', ' ')[count > 0] - print(prefix, line) + printw("{}{}".format(prefix, line)) count += 1 class CheckOnePatch: -- 2.21.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#51790): https://edk2.groups.io/g/devel/message/51790 Mute This Topic: https://groups.io/mt/67004076/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-