Change print statements to work in python3
This is part of a series of changes to introduce Python3 support.
Change-Id: I373be5de7141aa127d7debdbce1df39148dbec32
diff --git a/project.py b/project.py
index f72b1c8..20a8dca 100644
--- a/project.py
+++ b/project.py
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import print_function
import traceback
import errno
import filecmp
@@ -50,7 +51,7 @@
def _error(fmt, *args):
msg = fmt % args
- print >>sys.stderr, 'error: %s' % msg
+ print('error: %s' % msg, file=sys.stderr)
def not_rev(r):
return '^' + r
@@ -683,9 +684,9 @@
if not os.path.isdir(self.worktree):
if output_redir == None:
output_redir = sys.stdout
- print >>output_redir, ''
- print >>output_redir, 'project %s/' % self.relpath
- print >>output_redir, ' missing (run "repo sync")'
+ print(file=output_redir)
+ print('project %s/' % self.relpath, file=output_redir)
+ print(' missing (run "repo sync")', file=output_redir)
return
self.work_git.update_index('-q',
@@ -785,7 +786,7 @@
out.project('project %s/' % self.relpath)
out.nl()
has_diff = True
- print line[:-1]
+ print(line[:-1])
p.Wait()
@@ -1586,7 +1587,8 @@
# returned another error with the HTTP error code being 400 or above.
# This return code only appears if -f, --fail is used.
if not quiet:
- print >> sys.stderr, "Server does not provide clone.bundle; ignoring."
+ print("Server does not provide clone.bundle; ignoring.",
+ file=sys.stderr)
return False
if os.path.exists(tmpPath):