]> granicus.if.org Git - clang/commitdiff
Py3k compat for clang-format Sublime Text extension.
authorSean Silva <silvas@purdue.edu>
Fri, 8 Nov 2013 22:46:56 +0000 (22:46 +0000)
committerSean Silva <silvas@purdue.edu>
Fri, 8 Nov 2013 22:46:56 +0000 (22:46 +0000)
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!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194287 91177308-0d34-0410-b5e6-96231b3b80d8

tools/clang-format/clang-format-sublime.py

index 2099d7a98c6b4a7838b7c6bd5ecdd96321435ecd..16ff56e502c66f71c1cbeb06c49cdbd50a8fc6df 100644 (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))