|
|
edce02 |
From a1bccf89a02accab69b359ef004faa95257333c0 Mon Sep 17 00:00:00 2001
|
|
|
edce02 |
From: Tom Stellard <tstellar@redhat.com>
|
|
|
edce02 |
Date: Fri, 7 Sep 2018 18:27:16 +0000
|
|
|
edce02 |
Subject: [PATCH] Convert clang-format-diff.py to python3 using 2to3
|
|
|
edce02 |
|
|
|
edce02 |
---
|
|
|
edce02 |
tools/clang-format/clang-format-diff.py | 10 +++++-----
|
|
|
edce02 |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
edce02 |
|
|
|
edce02 |
diff --git a/tools/clang-format/clang-format-diff.py b/tools/clang-format/clang-format-diff.py
|
|
|
edce02 |
index ffa30e70dd..1525a3815c 100755
|
|
|
edce02 |
--- a/tools/clang-format/clang-format-diff.py
|
|
|
edce02 |
+++ b/tools/clang-format/clang-format-diff.py
|
|
|
edce02 |
@@ -1,4 +1,4 @@
|
|
|
edce02 |
-#!/usr/bin/env python
|
|
|
edce02 |
+#!/usr/bin/python3
|
|
|
edce02 |
#
|
|
|
edce02 |
#===- clang-format-diff.py - ClangFormat Diff Reformatter ----*- python -*--===#
|
|
|
edce02 |
#
|
|
|
edce02 |
@@ -27,7 +27,7 @@ import difflib
|
|
|
edce02 |
import re
|
|
|
edce02 |
import string
|
|
|
edce02 |
import subprocess
|
|
|
edce02 |
-import StringIO
|
|
|
edce02 |
+import io
|
|
|
edce02 |
import sys
|
|
|
edce02 |
|
|
|
edce02 |
|
|
|
edce02 |
@@ -89,9 +89,9 @@ def main():
|
|
|
edce02 |
['-lines', str(start_line) + ':' + str(end_line)])
|
|
|
edce02 |
|
|
|
edce02 |
# Reformat files containing changes in place.
|
|
|
edce02 |
- for filename, lines in lines_by_file.iteritems():
|
|
|
edce02 |
+ for filename, lines in lines_by_file.items():
|
|
|
edce02 |
if args.i and args.verbose:
|
|
|
edce02 |
- print 'Formatting', filename
|
|
|
edce02 |
+ print('Formatting', filename)
|
|
|
edce02 |
command = [args.binary, filename]
|
|
|
edce02 |
if args.i:
|
|
|
edce02 |
command.append('-i')
|
|
|
edce02 |
@@ -109,7 +109,7 @@ def main():
|
|
|
edce02 |
if not args.i:
|
|
|
edce02 |
with open(filename) as f:
|
|
|
edce02 |
code = f.readlines()
|
|
|
edce02 |
- formatted_code = StringIO.StringIO(stdout).readlines()
|
|
|
edce02 |
+ formatted_code = io.StringIO(stdout).readlines()
|
|
|
edce02 |
diff = difflib.unified_diff(code, formatted_code,
|
|
|
edce02 |
filename, filename,
|
|
|
edce02 |
'(before formatting)', '(after formatting)')
|
|
|
edce02 |
--
|
|
|
edce02 |
2.14.3
|
|
|
edce02 |
|