Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac1ea4ed authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "scripts: update gcc-wrapper to python3"

parents 9bef368b 4b830694
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
#! /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