//build: Convert print statements to Python 3 style

Ran "2to3 -w -n -f print ./base" and manually added imports.
There are no intended behaviour changes.

Bug: 941669
Change-Id: Ie2830e213eae3a5d7753ce503020e02811b726d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1585890
Commit-Queue: Raul Tambre <[email protected]>
Reviewed-by: Nico Weber <[email protected]>
Reviewed-by: Dirk Pranke <[email protected]>
Auto-Submit: Raul Tambre <[email protected]>
Cr-Commit-Position: refs/heads/master@{#658917}
diff --git a/build/check_gn_headers.py b/build/check_gn_headers.py
index 2de11b83..9bdbba8 100755
--- a/build/check_gn_headers.py
+++ b/build/check_gn_headers.py
@@ -9,6 +9,8 @@
 dependency generated by the compiler, and report if they don't exist in GN.
 """
 
+from __future__ import print_function
+
 import argparse
 import json
 import os
@@ -152,7 +154,7 @@
     out = subprocess.check_output(cmd)
     return 'no work to do.' in out
   except Exception as e:
-    print e
+    print(e)
     return False
 
 def ParseWhiteList(whitelist):
@@ -211,7 +213,7 @@
       # Assume running on the bots. Silently skip this step.
       # This is possible because "analyze" step can be wrong due to
       # underspecified header files. See crbug.com/725877
-      print dirty_msg
+      print(dirty_msg)
       DumpJson([])
       return 0
     else:
@@ -250,7 +252,7 @@
   if deps_err:
     PrintError(deps_err)
   if len(GetNonExistingFiles(d)) > 0:
-    print 'Non-existing files in ninja deps:', GetNonExistingFiles(d)
+    print('Non-existing files in ninja deps:', GetNonExistingFiles(d))
     PrintError('Found non-existing files in ninja deps. You should ' +
                'build all in OUT_DIR.')
   if len(d) == 0:
@@ -272,30 +274,30 @@
     return 0
 
   if len(missing) > 0:
-    print '\nThe following files should be included in gn files:'
+    print('\nThe following files should be included in gn files:')
     for i in missing:
-      print i
+      print(i)
 
   if len(nonexisting) > 0:
-    print '\nThe following non-existing files should be removed from gn files:'
+    print('\nThe following non-existing files should be removed from gn files:')
     for i in nonexisting:
-      print i
+      print(i)
 
   if args.verbose:
     # Only get detailed obj dependency here since it is slower.
     GetHeadersFromNinja(args.out_dir, False, d_q)
     d, d_err = d_q.get()
-    print '\nDetailed dependency info:'
+    print('\nDetailed dependency info:')
     for f in missing:
-      print f
+      print(f)
       for cc in d[f]:
-        print '  ', cc
+        print('  ', cc)
 
-    print '\nMissing headers sorted by number of affected object files:'
+    print('\nMissing headers sorted by number of affected object files:')
     count = {k: len(v) for (k, v) in d.iteritems()}
     for f in sorted(count, key=count.get, reverse=True):
       if f in missing:
-        print count[f], f
+        print(count[f], f)
 
   if args.json:
     # Assume running on the bots. Temporarily return 0 before