| Index: gclient.py
 | 
| diff --git a/gclient.py b/gclient.py
 | 
| index fab867b7439b4dfa957c1bbdb17d923049484b7b..f258890518b830655ec3a191134fcfe82d50bb2b 100755
 | 
| --- a/gclient.py
 | 
| +++ b/gclient.py
 | 
| @@ -76,6 +76,8 @@
 | 
|  #     target_os = [ "ios" ]
 | 
|  #     target_os_only = True
 | 
|  
 | 
| +from __future__ import print_function
 | 
| +
 | 
|  __version__ = '0.7'
 | 
|  
 | 
|  import ast
 | 
| @@ -244,7 +246,7 @@ class DependencySettings(GClientKeywords):
 | 
|      if (self._custom_vars.get('webkit_trunk', '') ==
 | 
|          'svn://svn-mirror.golo.chromium.org/webkit-readonly/trunk'):
 | 
|        new_url = 'svn://svn-mirror.golo.chromium.org/blink/trunk'
 | 
| -      print 'Overwriting Var("webkit_trunk") with %s' % new_url
 | 
| +      print('Overwriting Var("webkit_trunk") with %s' % new_url)
 | 
|        self._custom_vars['webkit_trunk'] = new_url
 | 
|  
 | 
|      # Post process the url to remove trailing slashes.
 | 
| @@ -884,24 +886,24 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
 | 
|  
 | 
|                match = re.match('^Binary file ([^\0]+) matches$', line)
 | 
|                if match:
 | 
| -                print 'Binary file %s matches\n' % mod_path(match.group(1))
 | 
| +                print('Binary file %s matches\n' % mod_path(match.group(1)))
 | 
|                  return
 | 
|  
 | 
|                items = line.split('\0')
 | 
|                if len(items) == 2 and items[1]:
 | 
| -                print '%s : %s' % (mod_path(items[0]), items[1])
 | 
| +                print('%s : %s' % (mod_path(items[0]), items[1]))
 | 
|                elif len(items) >= 2:
 | 
|                  # Multiple null bytes or a single trailing null byte indicate
 | 
|                  # git is likely displaying filenames only (such as with -l)
 | 
| -                print '\n'.join(mod_path(path) for path in items if path)
 | 
| +                print('\n'.join(mod_path(path) for path in items if path))
 | 
|                else:
 | 
| -                print line
 | 
| +                print(line)
 | 
|            else:
 | 
|              print_stdout = True
 | 
|              filter_fn = None
 | 
|  
 | 
|            if parsed_url is None:
 | 
| -            print >> sys.stderr, 'Skipped omitted dependency %s' % cwd
 | 
| +            print('Skipped omitted dependency %s' % cwd, file=sys.stderr)
 | 
|            elif os.path.isdir(cwd):
 | 
|              try:
 | 
|                gclient_utils.CheckCallAndFilter(
 | 
| @@ -912,7 +914,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
 | 
|                if not options.ignore:
 | 
|                  raise
 | 
|            else:
 | 
| -            print >> sys.stderr, 'Skipped missing %s' % cwd
 | 
| +            print('Skipped missing %s' % cwd, file=sys.stderr)
 | 
|  
 | 
|  
 | 
|    @gclient_utils.lockedmethod
 | 
| @@ -985,13 +987,13 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
 | 
|          # Use a discrete exit status code of 2 to indicate that a hook action
 | 
|          # failed.  Users of this script may wish to treat hook action failures
 | 
|          # differently from VC failures.
 | 
| -        print >> sys.stderr, 'Error: %s' % str(e)
 | 
| +        print('Error: %s' % str(e), file=sys.stderr)
 | 
|          sys.exit(2)
 | 
|        finally:
 | 
|          elapsed_time = time.time() - start_time
 | 
|          if elapsed_time > 10:
 | 
| -          print "Hook '%s' took %.2f secs" % (
 | 
| -              gclient_utils.CommandToStr(hook), elapsed_time)
 | 
| +          print("Hook '%s' took %.2f secs" % (
 | 
| +              gclient_utils.CommandToStr(hook), elapsed_time))
 | 
|  
 | 
|    def RunPreDepsHooks(self):
 | 
|      assert self.processed
 | 
| @@ -1010,13 +1012,13 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
 | 
|          # Use a discrete exit status code of 2 to indicate that a hook action
 | 
|          # failed.  Users of this script may wish to treat hook action failures
 | 
|          # differently from VC failures.
 | 
| -        print >> sys.stderr, 'Error: %s' % str(e)
 | 
| +        print('Error: %s' % str(e), file=sys.stderr)
 | 
|          sys.exit(2)
 | 
|        finally:
 | 
|          elapsed_time = time.time() - start_time
 | 
|          if elapsed_time > 10:
 | 
| -          print "Hook '%s' took %.2f secs" % (
 | 
| -              gclient_utils.CommandToStr(hook), elapsed_time)
 | 
| +          print("Hook '%s' took %.2f secs" % (
 | 
| +              gclient_utils.CommandToStr(hook), elapsed_time))
 | 
|  
 | 
|  
 | 
|    def subtree(self, include_all):
 | 
| @@ -1389,13 +1391,14 @@ been automagically updated.  The previous version is available at %s.old.
 | 
|      if (options.revisions and
 | 
|          len(client.dependencies) > 1 and
 | 
|          any('@' not in r for r in options.revisions)):
 | 
| -      print >> sys.stderr, (
 | 
| -          'You must specify the full solution name like --revision %s@%s\n'
 | 
| -          'when you have multiple solutions setup in your .gclient file.\n'
 | 
| -          'Other solutions present are: %s.') % (
 | 
| +      print(
 | 
| +          ('You must specify the full solution name like --revision %s@%s\n'
 | 
| +           'when you have multiple solutions setup in your .gclient file.\n'
 | 
| +           'Other solutions present are: %s.') % (
 | 
|                client.dependencies[0].name,
 | 
|                options.revisions[0],
 | 
| -              ', '.join(s.name for s in client.dependencies[1:]))
 | 
| +              ', '.join(s.name for s in client.dependencies[1:])),
 | 
| +          file=sys.stderr)
 | 
|      return client
 | 
|  
 | 
|    def SetDefaultConfig(self, solution_name, deps_file, solution_url,
 | 
| @@ -1519,8 +1522,8 @@ been automagically updated.  The previous version is available at %s.old.
 | 
|        work_queue.enqueue(s)
 | 
|      work_queue.flush(revision_overrides, command, args, options=self._options)
 | 
|      if revision_overrides:
 | 
| -      print >> sys.stderr, ('Please fix your script, having invalid '
 | 
| -                            '--revision flags will soon considered an error.')
 | 
| +      print('Please fix your script, having invalid --revision flags will soon '
 | 
| +            'considered an error.', file=sys.stderr)
 | 
|  
 | 
|      # Once all the dependencies have been processed, it's now safe to run the
 | 
|      # hooks.
 | 
| @@ -1763,13 +1766,14 @@ def CMDrecurse(parser, args):
 | 
|                      help='Disable progress bar that shows sub-command updates')
 | 
|    options, args = parser.parse_args(args)
 | 
|    if not args:
 | 
| -    print >> sys.stderr, 'Need to supply a command!'
 | 
| +    print('Need to supply a command!', file=sys.stderr)
 | 
|      return 1
 | 
|    root_and_entries = gclient_utils.GetGClientRootAndEntries()
 | 
|    if not root_and_entries:
 | 
| -    print >> sys.stderr, (
 | 
| +    print(
 | 
|          'You need to run gclient sync at least once to use \'recurse\'.\n'
 | 
| -        'This is because .gclient_entries needs to exist and be up to date.')
 | 
| +        'This is because .gclient_entries needs to exist and be up to date.',
 | 
| +        file=sys.stderr)
 | 
|      return 1
 | 
|  
 | 
|    # Normalize options.scm to a set()
 | 
| @@ -1803,13 +1807,13 @@ def CMDgrep(parser, args):
 | 
|    # We can't use optparse because it will try to parse arguments sent
 | 
|    # to git grep and throw an error. :-(
 | 
|    if not args or re.match('(-h|--help)$', args[0]):
 | 
| -    print >> sys.stderr, (
 | 
| +    print(
 | 
|          'Usage: gclient grep [-j <N>] git-grep-args...\n\n'
 | 
|          'Example: "gclient grep -j10 -A2 RefCountedBase" runs\n"git grep '
 | 
|          '-A2 RefCountedBase" on each of gclient\'s git\nrepos with up to '
 | 
|          '10 jobs.\n\nBonus: page output by appending "|& less -FRSX" to the'
 | 
| -        ' end of your query.'
 | 
| -        )
 | 
| +        ' end of your query.',
 | 
| +        file=sys.stderr)
 | 
|      return 1
 | 
|  
 | 
|    jobs_arg = ['--jobs=1']
 | 
| @@ -2177,7 +2181,7 @@ def CMDhookinfo(parser, args):
 | 
|    if not client:
 | 
|      raise gclient_utils.Error('client not configured; see \'gclient config\'')
 | 
|    client.RunOnDeps(None, [])
 | 
| -  print '; '.join(' '.join(hook) for hook in client.GetHooks(options))
 | 
| +  print('; '.join(' '.join(hook) for hook in client.GetHooks(options)))
 | 
|    return 0
 | 
|  
 | 
|  
 | 
| @@ -2193,10 +2197,10 @@ def CMDverify(parser, args):
 | 
|      bad_deps = dep.findDepsFromNotAllowedHosts()
 | 
|      if not bad_deps:
 | 
|        continue
 | 
| -    print "There are deps from not allowed hosts in file %s" % dep.deps_file
 | 
| +    print("There are deps from not allowed hosts in file %s" % dep.deps_file)
 | 
|      for bad_dep in bad_deps:
 | 
| -      print "\t%s at %s" % (bad_dep.name, bad_dep.url)
 | 
| -    print "allowed_hosts:", ', '.join(dep.allowed_hosts)
 | 
| +      print("\t%s at %s" % (bad_dep.name, bad_dep.url))
 | 
| +    print("allowed_hosts:", ', '.join(dep.allowed_hosts))
 | 
|      sys.stdout.flush()
 | 
|      raise gclient_utils.Error(
 | 
|          'dependencies from disallowed hosts; check your DEPS file.')
 | 
| @@ -2289,13 +2293,15 @@ def main(argv):
 | 
|    """Doesn't parse the arguments here, just find the right subcommand to
 | 
|    execute."""
 | 
|    if sys.hexversion < 0x02060000:
 | 
| -    print >> sys.stderr, (
 | 
| +    print(
 | 
|          '\nYour python version %s is unsupported, please upgrade.\n' %
 | 
| -        sys.version.split(' ', 1)[0])
 | 
| +        sys.version.split(' ', 1)[0],
 | 
| +        file=sys.stderr)
 | 
|      return 2
 | 
|    if not sys.executable:
 | 
| -    print >> sys.stderr, (
 | 
| -        '\nPython cannot find the location of it\'s own executable.\n')
 | 
| +    print(
 | 
| +        '\nPython cannot find the location of it\'s own executable.\n',
 | 
| +        file=sys.stderr)
 | 
|      return 2
 | 
|    fix_encoding.fix_encoding()
 | 
|    disable_buffering()
 | 
| @@ -2307,7 +2313,7 @@ def main(argv):
 | 
|      gclient_utils.GClientChildren.KillAllRemainingChildren()
 | 
|      raise
 | 
|    except (gclient_utils.Error, subprocess2.CalledProcessError), e:
 | 
| -    print >> sys.stderr, 'Error: %s' % str(e)
 | 
| +    print('Error: %s' % str(e), file=sys.stderr)
 | 
|      return 1
 | 
|    finally:
 | 
|      gclient_utils.PrintWarnings()
 | 
| 
 |