binman: Convert print statements to Python 3
authorSimon Glass <sjg@chromium.org>
Tue, 14 May 2019 21:53:37 +0000 (15:53 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 10 Jul 2019 22:52:45 +0000 (16:52 -0600)
Update all print statements to be functions, as required by Python 3.

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

index 439908e66508045e78563617304e3d36dffe9417..4206d2b0e3d4597a0fcf6ca4bc6fac04e5a7672a 100755 (executable)
@@ -9,6 +9,8 @@
 
 """See README for more information"""
 
+from __future__ import print_function
+
 import glob
 import multiprocessing
 import os
@@ -85,13 +87,13 @@ def RunTests(debug, processes, args):
     else:
         suite.run(result)
 
-    print result
+    print(result)
     for test, err in result.errors:
-        print test.id(), err
+        print(test.id(), err)
     for test, err in result.failures:
-        print err, result.failures
+        print(err, result.failures)
     if result.errors or result.failures:
-      print 'binman tests FAILED'
+      print('binman tests FAILED')
       return 1
     return 0
 
@@ -143,9 +145,9 @@ def RunBinman(options, args):
         try:
             ret_code = control.Binman(options, args)
         except Exception as e:
-            print 'binman: %s' % e
+            print('binman: %s' % e)
             if options.debug:
-                print
+                print()
                 traceback.print_exc()
             ret_code = 1
     return ret_code
index b32e4e1996fb297287ca00c74f529be969c107ca..8f7f9068604f0f6077cb357940b1630d5956d737 100644 (file)
@@ -5,6 +5,8 @@
 # Creates binary images from input files controlled by a description
 #
 
+from __future__ import print_function
+
 from collections import OrderedDict
 import os
 import sys
@@ -134,7 +136,7 @@ def Binman(options, args):
                         del images[name]
                         skip.append(name)
                 if skip and options.verbosity >= 2:
-                    print 'Skipping images: %s' % ', '.join(skip)
+                    print('Skipping images: %s' % ', '.join(skip))
 
             state.Prepare(images, dtb)
 
@@ -170,7 +172,7 @@ def Binman(options, args):
                 except Exception as e:
                     if options.map:
                         fname = image.WriteMap()
-                        print "Wrote map file '%s' to show errors"  % fname
+                        print("Wrote map file '%s' to show errors"  % fname)
                     raise
                 image.SetImagePos()
                 if options.update_fdt: