CHERRY-PICK: 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

Original-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>
(cherry picked from commit 09d6a3d6e700eee002cc8df3b125ae2d56ec5acc)

Change-Id: Ic871760cd6af9d5ae7798cc01144429825e0f243
Reviewed-on: https://chromium-review.googlesource.com/210010
Reviewed-by: Bowgo Tsai <bowgotsai@chromium.org>
Commit-Queue: Bowgo Tsai <bowgotsai@chromium.org>
Tested-by: Bowgo Tsai <bowgotsai@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 f6ecead..5387626 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
@@ -629,7 +631,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])
@@ -742,7 +744,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)
 
 
@@ -876,7 +878,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)
@@ -900,6 +902,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