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