Revert "Fix shebang" This change is causing gBMC builds to fail. Reverting it for now. This reverts commit 9f70450adae45ced1647d1646c9bebf898502da9. Change-Id: Id145012dc7ad5d0ec57b5d37ec7d9ab090fd2199
diff --git a/git-cookie-authdaemon b/git-cookie-authdaemon index 4a5e718..d16651f 100755 --- a/git-cookie-authdaemon +++ b/git-cookie-authdaemon
@@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/python # Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,13 +22,10 @@ is needed. '--debug' option is available. """ -from urllib.error import HTTPError -from urllib.error import URLError -from urllib.request import urlopen, Request +from __future__ import print_function import atexit import contextlib -import http.cookiejar as cookielib import json import os import platform @@ -36,6 +33,17 @@ import sys import time +if sys.version_info[0] > 2: + # Python 3 imports + from urllib.request import urlopen, Request + from urllib.error import URLError + from urllib.error import HTTPError + import http.cookiejar as cookielib +else: + # Python 2 imports + from urllib2 import urlopen, Request, HTTPError, URLError + import cookielib + REFRESH = 25 # seconds remaining when starting refresh RETRY_INTERVAL = 5 # seconds between retrying a failed refresh
diff --git a/git-googlesource-login b/git-googlesource-login index 506f42e..f710795 100755 --- a/git-googlesource-login +++ b/git-googlesource-login
@@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/python # Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,12 +20,19 @@ Git variable http.cookiefile to this path. """ -from subprocess import Popen, PIPE, check_call +from __future__ import print_function -import http.cookiejar as cookielib import os +from subprocess import Popen, PIPE, check_call import sys +if sys.version_info[0] > 2: + # Python 3 imports + import http.cookiejar as cookielib +else: + # Python 2 imports + import cookielib + try: # We want to use raw_input in Python 2. input = raw_input