Py3k compat for clang-format Sublime Text extension.

Sublime Text 2 uses Python 2.6
Sublime Text 3 uses Python 3.3

The `print` function has been available as a __future__ import since
2.6, so use it.

Patch by Johan Engelen!

llvm-svn: 194287
This commit is contained in:
Sean Silva 2013-11-08 22:46:56 +00:00
parent 71f87cb33a
commit 60dccf2d06
1 changed files with 2 additions and 1 deletions

View File

@ -12,6 +12,7 @@
# It operates on the current, potentially unsaved buffer and does not create
# or save any files. To revert a formatting, just undo.
from __future__ import print_function
import sublime
import sublime_plugin
import subprocess
@ -45,7 +46,7 @@ class ClangFormatCommand(sublime_plugin.TextCommand):
stderr=subprocess.PIPE, stdin=subprocess.PIPE)
output, error = p.communicate(buf.encode(encoding))
if error:
print error
print(error)
self.view.replace(
edit, sublime.Region(0, self.view.size()),
output.decode(encoding))