config/system_header_util.py
author Oana Pop Rus <opoprus@mozilla.com>
Tue, 23 Apr 2019 00:48:20 +0300
changeset 470383 4c7eaf384b06cfda8314be34cd179ab46f271ccc
parent 447614 b6c97b4db60a1d8169a3e798a248144ab2973506
child 481703 9c5b3c7e1ca2240f765d62466cc917ad778407ef
permissions -rw-r--r--
Merge inbound to mozilla-central. a=merge

import os


def find_in_path(file, searchpath):
    for dir in searchpath.split(os.pathsep):
        f = os.path.join(dir, file)
        if os.path.exists(f):
            return f
    return ''


def header_path(header, compiler):
    if compiler == 'gcc':
        # we use include_next on gcc
        return header
    elif compiler == 'msvc':
        return find_in_path(header, os.environ.get('INCLUDE', ''))
    else:
        # hope someone notices this ...
        raise NotImplementedError(compiler)