convert to print function

Newer repo's sometimes import the print function on us, and then import
these python files directly which then throws an error.  Convert us to
the print function to avoid it.  It's not a bad thing.

BUG=None
TEST=`./pre-upload_unittest.py` passes

Change-Id: I4a633620c493d5e16bee2ef36a86ccaf2792dfaa
Reviewed-on: https://chromium-review.googlesource.com/172340
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/errors.py b/errors.py
index 198d0e2..398223a 100644
--- a/errors.py
+++ b/errors.py
@@ -2,6 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+from __future__ import print_function
+
 import re
 import sys
 
@@ -30,7 +32,7 @@
   """
   regex = re.compile(r'^', re.M)
   msg = regex.sub(_INDENT * indent_level, msg)
-  print >> sys.stderr, msg
+  print(msg, file=sys.stderr)
 
 
 def _FormatCommitDesc(desc):
@@ -57,7 +59,7 @@
   """
   _PrintWithIndent(_PROJECT_INFO % project, 0)
   _PrintWithIndent(_FormatHookFailure(error), 1)
-  print >> sys.stderr, ''
+  print('', file=sys.stderr)
 
 
 def PrintErrorsForCommit(project, commit, commit_desc, error_list):
@@ -98,5 +100,4 @@
   for error in error_list:
     _PrintWithIndent(_FormatHookFailure(error), 3)
 
-  print >> sys.stderr, ''
-
+  print('', file=sys.stderr)
diff --git a/pre-upload.py b/pre-upload.py
index f7cbeb9..b281ed9 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -3,6 +3,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+from __future__ import print_function
+
 import ConfigParser
 import functools
 import json
@@ -655,7 +657,7 @@
       if not config.getboolean(SECTION, flag): disable_flags.append(flag)
     except ValueError as e:
       msg = "Error parsing flag \'%s\' in %s file - " % (flag, _CONFIG_FILE)
-      print msg + str(e)
+      print(msg + str(e))
 
   disabled_keys = set(_DISABLE_FLAGS.iterkeys()).intersection(disable_flags)
   return set([_DISABLE_FLAGS[key] for key in disabled_keys])
@@ -768,7 +770,7 @@
            '- To disable some source style checks, and for other hints, see '
            '<checkout_dir>/src/repohooks/README\n'
            '- To upload only current project, run \'repo upload .\'')
-    print >> sys.stderr, msg
+    print(msg, file=sys.stderr)
     sys.exit(1)
 
 
@@ -902,7 +904,7 @@
       raise BadInvocation("Repo couldn't identify the project of %s" % opts.dir)
 
   if verbose:
-    print "Running hooks on %s" % (opts.project)
+    print("Running hooks on %s" % (opts.project))
 
   found_error = _run_project_hooks(opts.project, proj_dir=opts.dir,
                                    commit_list=args)
@@ -926,6 +928,6 @@
     try:
       exit_code = direct_main(sys.argv)
     except BadInvocation, e:
-      print >>sys.stderr, "%s: %s" % (prog_name, str(e))
+      print("%s: %s" % (prog_name, str(e)), file=sys.stderr)
       exit_code = 1
   sys.exit(exit_code)
diff --git a/pre-upload_unittest.py b/pre-upload_unittest.py
index 9812a61..1272862 100755
--- a/pre-upload_unittest.py
+++ b/pre-upload_unittest.py
@@ -4,6 +4,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+from __future__ import print_function
+
 import mox
 import os
 import sys