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