config/system_header_util.py
author Alexander Surkov <surkov.alexander@gmail.com>
Thu, 07 Mar 2019 17:43:51 +0000
changeset 520859 4256ff8a181c94740e6387f7b7618d314fd56d71
parent 504105 b6c97b4db60a1d8169a3e798a248144ab2973506
child 542190 9c5b3c7e1ca2240f765d62466cc917ad778407ef
permissions -rw-r--r--
Bug 1533396 - Can't create a new profile with the Profile Manager, r=mossop Differential Revision: https://phabricator.services.mozilla.com/D22544

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)