diff --git a/scripts/gcc-wrapper.py b/scripts/gcc-wrapper.py index 11ce68d96fe6..20d0331d5f2f 100755 --- a/scripts/gcc-wrapper.py +++ b/scripts/gcc-wrapper.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python2 +#! /usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-only # Copyright (c) 2011-2017, 2018 The Linux Foundation. All rights reserved. @@ -32,10 +32,10 @@ ofile = None warning_re = re.compile(r'''(.*/|)([^/]+\.[a-z]+:\d+):(\d+:)? warning:''') def interpret_warning(line): """Decode the message from gcc. The messages we care about have a filename, and a warning""" - line = line.rstrip('\n') + line = line.rstrip().decode() m = warning_re.match(line) if m and m.group(2) not in allowed_warnings: - print "error, forbidden warning:", m.group(2) + print("error, forbidden warning:", m.group(2)) # If there is a warning, remove any object if it exists. if ofile: @@ -60,17 +60,17 @@ def run_gcc(): try: proc = subprocess.Popen(args, stderr=subprocess.PIPE) for line in proc.stderr: - print line, + print(line, end=' ') interpret_warning(line) result = proc.wait() except OSError as e: result = e.errno if result == errno.ENOENT: - print args[0] + ':',e.strerror - print 'Is your PATH set correctly?' + print(args[0] + ':',e.strerror) + print('Is your PATH set correctly?') else: - print ' '.join(args), str(e) + print(' '.join(args), str(e)) return result