vim: Make format plugin work with py2 and py3 Google's Linux distro's Vim seems to have dropped +python, so port the format script to work with both 2 and 3. Change-Id: I4d6b3876cf159791f16cd8109c31b4219ddc8983 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/7240 Commit-Queue: Nico Weber <thakis@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org>
diff --git a/misc/vim/gn-format.py b/misc/vim/gn-format.py index 6170851..f21f1b9 100644 --- a/misc/vim/gn-format.py +++ b/misc/vim/gn-format.py
@@ -18,6 +18,7 @@ import subprocess import sys import vim +from __future__ import print_function # Change this to the full path if gn is not on the path. binary = 'gn' @@ -44,8 +45,8 @@ shell=is_win, universal_newlines=True) stdout, stderr = p.communicate(input=text) if p.returncode != 0: - print 'Formatting failed, please report to gn-dev@chromium.org.' - print stdout, stderr + print('Formatting failed, please report to gn-dev@chromium.org.') + print(stdout, stderr) else: # Otherwise, replace current buffer. lines = stdout.split('\n')