This is an automated email from the ASF dual-hosted git repository.
granthenke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new 965e59f [build] Make IWYU scipts compatible with Python 3
965e59f is described below
commit 965e59f5a3d8dfaef70f30e08ddbec82f7ef3234
Author: Grant Henke <[email protected]>
AuthorDate: Mon Jan 13 09:08:42 2020 -0600
[build] Make IWYU scipts compatible with Python 3
This patch makes minor adjustments to iwyu.py to make it
compatible with Python 3.
Change-Id: I979e96f66261146571ffc45f8222ad0fc15d1073
Reviewed-on: http://gerrit.cloudera.org:8080/15031
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <[email protected]>
---
build-support/iwyu.py | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/build-support/iwyu.py b/build-support/iwyu.py
index 60cc9a4..ff1a6ed 100755
--- a/build-support/iwyu.py
+++ b/build-support/iwyu.py
@@ -18,7 +18,7 @@
# under the License.
from __future__ import print_function
-from cStringIO import StringIO
+from io import BytesIO
import glob
import json
import logging
@@ -99,8 +99,7 @@ _BUILD_DIR = os.path.join(ROOT, 'build/latest')
def _get_file_list_from_git():
upstream_commit = get_upstream_commit()
out = check_output(["git", "diff", "--name-only",
upstream_commit]).splitlines()
- return [l for l in out if _RE_SOURCE_FILE.search(l)]
-
+ return [l.decode('utf-8') for l in out if
_RE_SOURCE_FILE.search(l.decode('utf-8'))]
def _get_paths_from_compilation_db():
db_path = os.path.join(_BUILD_DIR, 'compile_commands.json')
@@ -128,13 +127,13 @@ def _run_iwyu_tool(paths):
"%s") % (" ".join(cmdline), output))
try:
- output = check_output(cmdline, env=env, stderr=subprocess.STDOUT)
+ output = check_output(cmdline, env=env,
stderr=subprocess.STDOUT).decode('utf-8')
if '\nFATAL ERROR: ' in output or \
'Assertion failed: ' in output or \
_RE_CLANG_ERROR.search(output):
crash(output)
return output
- except subprocess.CalledProcessError, e:
+ except subprocess.CalledProcessError as e:
crash(e.output)
@@ -176,7 +175,7 @@ def _do_iwyu(flags, paths):
logging.info("Dumping iwyu output to %s", flags.dump_iwyu_output)
with file(flags.dump_iwyu_output, "w") as f:
print(iwyu_output, file=f)
- stream = StringIO(iwyu_output)
+ stream = BytesIO(iwyu_output)
fixer_flags = _get_fixer_flags(flags)
# Passing None as 'fix_paths' tells the fixer script to process