patman: Update flushing Print() for Python 3
authorSimon Glass <sjg@chromium.org>
Thu, 9 Apr 2020 21:08:39 +0000 (15:08 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 21 Apr 2020 12:33:47 +0000 (06:33 -0600)
This does not seem to work on Python 3. Update the code to use the
built-in support.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/patman/terminal.py

index 7a3b658b00e866fa609d1bf28114790deb0e4234..6541fa8f410412f829e477b6a942fd8185560a34 100644 (file)
@@ -53,11 +53,10 @@ def Print(text='', newline=True, colour=None):
         if colour:
             col = Color()
             text = col.Color(colour, text)
-        print(text, end='')
         if newline:
-            print()
+            print(text)
         else:
-            sys.stdout.flush()
+            print(text, end='', flush=True)
 
 def SetPrintTestMode():
     """Go into test mode, where all printing is recorded"""