Example #1
0
def get_predefines():
    short_options = "m:f:O:"
    long_options = []
    o, a = cu_lib.collect_options(short_options, long_options, sys.argv[1:])
    commands = [os.environ["YZ_CC_PATH"]]
    commands += o
    commands += ("-E", "-x", ext_get(a), "-dM", "/dev/null")

    sp = subprocess.Popen(commands, stdout=subprocess.PIPE)
    results, err = sp.communicate()
    if sp.returncode != 0:
        print >> sys.stderr, "Got %d on executing:" % sp.returncode
        print >> sys.stderr, "  %s" % " ".join(commands)
        exit(1)

    sys.stdout.write(results)
Example #2
0
def get_search_dirs():
    flag = False
    short_options = "m:f:O:"
    long_options = []
    o, a = cu_lib.collect_options(short_options, long_options, sys.argv[1:])
    commands = [os.environ["YZ_CC_PATH"], "-E", "-x", ext_get(a), "-v", "/dev/null"]

    sp = subprocess.Popen(commands, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    null, results = sp.communicate()
    if sp.returncode != 0:
        print >> sys.stderr, "Got %d on executing:" % sp.returncode
        print >> sys.stderr, "  %s" % " ".join(commands)
        exit(1)

    for line in results.split("\n"):
        if line == "#include <...> search starts here:":
            flag = True
        elif line == "End of search list.":
            break
        elif flag:
            fx = line.split()
            if len(fx) > 0:
                print fx[0]