Update print statements to be Python 3 compatible.
Change-Id: Ifcb890c22cb42a7cc2d641742d7093f7be2c59a9
diff --git a/git-cookie-authdaemon b/git-cookie-authdaemon
index 1b85291..eb40c30 100755
--- a/git-cookie-authdaemon
+++ b/git-cookie-authdaemon
@@ -22,6 +22,8 @@
is needed. '--debug' option is available.
"""
+from __future__ import print_function
+
import atexit
import contextlib
import cookielib
@@ -85,7 +87,7 @@
COOKIE_JAR = os.path.join(dir, 'cookie')
if '--debug' in sys.argv:
- print 'Cookie file: %s' % COOKIE_JAR
+ print('Cookie file: %s' % COOKIE_JAR)
if os.path.exists(dir):
os.chmod(dir, 0700)
@@ -136,9 +138,9 @@
cj.save()
if '--debug' in sys.argv:
- print 'Updating %s.' % COOKIE_JAR
- print 'Expires: %d, %s, in %d seconds'% (
- expires, time.ctime(expires), expires - now)
+ print('Updating %s.' % COOKIE_JAR)
+ print('Expires: %d, %s, in %d seconds'% (
+ expires, time.ctime(expires), expires - now))
sys.stdout.flush()
if IS_WINDOWS:
# os.rename() below on Windows will raise OSError when dst exists.
@@ -186,7 +188,7 @@
pid = os.fork()
if pid > 0:
- print 'git-cookie-authdaemon PID %d' % (pid)
+ print('git-cookie-authdaemon PID %d' % (pid))
sys.exit(0)
refresh_loop(scope, expires)
diff --git a/git-googlesource-login b/git-googlesource-login
index 6ebfa53..35068c2 100755
--- a/git-googlesource-login
+++ b/git-googlesource-login
@@ -20,6 +20,8 @@
Git variable http.cookiefile to this path.
"""
+from __future__ import print_function
+
import cookielib
import os
from subprocess import Popen, PIPE, check_call
@@ -69,10 +71,10 @@
return cj.filename
def main():
- print 'Open https://www.googlesource.com/new-password ...'
+ print('Open https://www.googlesource.com/new-password ...')
t = raw_input("Password (under 'Login for Git'): ")
p = write_cookie(t)
- print "Saved to %s" % (p,)
+ print("Saved to %s" % (p,))
if __name__ == '__main__':
main()