Exemplo n.º 1
0
def process_free_args(args, wine, bld_root, mode):
    short_names = {}
    winepath = os.path.join(os.path.dirname(wine), 'winepath')
    short_names[bld_root] = trim_path(bld_root, winepath)
    # Slow for no benefit.
    # arc_root = args.arcadia_root
    # short_names[arc_root] = trim_path(arc_root, winepath)

    free_args, wa_peers, wa_libs = pwa.get_whole_archive_peers_and_libs(
        pcf.skip_markers(args))

    process_link = lambda x: make_full_path_arg(x, bld_root, short_names[
        bld_root]) if mode in ('link', 'lib') else x

    def process_arg(arg):
        return fix_path(process_link(downsize_path(arg, short_names)))

    result = []
    for arg in free_args:
        if pcf.is_cmdfile_arg(arg):
            cmd_file_path = pcf.cmdfile_path(arg)
            cf_args = pcf.read_from_command_file(cmd_file_path)
            with open(cmd_file_path, 'w') as afile:
                for cf_arg in cf_args:
                    afile.write(process_arg(cf_arg) + "\n")
            result.append(arg)
        else:
            result.append(process_arg(arg))
    return pwa.ProcessWholeArchiveOption('WINDOWS', wa_peers,
                                         wa_libs).construct_cmd(result)
Exemplo n.º 2
0
    end_wa = '--end-wa'
    is_inside_wa = False
    for arg in args:
        if arg == start_wa:
            is_inside_wa = True
        elif arg == end_wa:
            is_inside_wa = False
        elif is_inside_wa:
            if not pcf.is_cmdfile_arg(arg):
                cmd.append(prefix + arg)
                continue
            cmd_file_path = pcf.cmdfile_path(arg)
            cf_args = pcf.read_from_command_file(cmd_file_path)
            with open(cmd_file_path, 'w') as afile:
                for cf_arg in cf_args:
                    afile.write(prefix + cf_arg + "\n")
            cmd.append(arg)
        else:
            cmd.append(arg)
    return cmd


if __name__ == '__main__':
    mode = sys.argv[1]
    cmd = process_whole_archive(pcf.skip_markers(sys.argv[2:]))
    run = out2err
    if mode in ('cl', 'ml'):
        # First line of cl.exe and ml64.exe stdout is useless: it prints input file
        run = out2err_cut_first_line
    sys.exit(run(cmd))
Exemplo n.º 3
0
import process_whole_archive_option as pwa

def out2err(cmd):
    return subprocess.Popen(cmd, stdout=sys.stderr).wait()


def out2err_cut_first_line(cmd):
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
    first_line = True
    while True:
        line = p.stdout.readline()
        if not line:
            break
        if first_line:
            sys.stdout.write(line)
            first_line = False
        else:
            sys.stderr.write(line)
    return p.wait()


if __name__ == '__main__':
    mode = sys.argv[1]
    args, wa_peers, wa_libs = pwa.get_whole_archive_peers_and_libs(pcf.skip_markers(sys.argv[2:]))
    cmd = pwa.ProcessWholeArchiveOption('WINDOWS', wa_peers, wa_libs).construct_cmd(args)
    run = out2err
    if mode in ('cl', 'ml'):
        # First line of cl.exe and ml64.exe stdout is useless: it prints input file
        run = out2err_cut_first_line
    sys.exit(run(cmd))
Exemplo n.º 4
0
import process_command_files as pcf


def out2err(cmd):
    return subprocess.Popen(cmd, stdout=sys.stderr).wait()


def out2err_cut_first_line(cmd):
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
    first_line = True
    while True:
        line = p.stdout.readline()
        if not line:
            break
        if first_line:
            sys.stdout.write(line)
            first_line = False
        else:
            sys.stderr.write(line)
    return p.wait()


if __name__ == '__main__':
    mode = sys.argv[1]
    cmd = pcf.skip_markers(sys.argv[2:])
    run = out2err
    if mode in ('cl', 'ml'):
        # First line of cl.exe and ml64.exe stdout is useless: it prints input file
        run = out2err_cut_first_line
    sys.exit(run(cmd))