def out_translate(platform, file_names, out_file, module_name,
                   translator_args, incremental):
    do_translate = False    # flag for incremental translate mode
    if translator_args.get('list_imports', None):
        do_translate = True
    # see if we can skip this module
    elif incremental:    # if we are in incremental translate mode
        # check for any files that need built
        for file_name in file_names:
            if is_modified(file_name,out_file):
                if platform is not None:
                    platform = "[%s] " % platform
                else:
                    platform = ''
                print "Translating %s:" % platform, file_name
                do_translate = True
                break
    if not incremental or do_translate:
        pydir = os.path.abspath(os.path.dirname(__file__))
        if not os.environ.has_key('PYJS_SYSPATH'):
            os.environ['PYJS_SYSPATH'] = sys.path[0]
        opts = ["--module-name", module_name, "-o"]
        if sys.platform == 'win32':
            opts.append(out_file)
            shell = False
        else:
            file_names = map(lambda x: x.replace(" ", r"\ "), file_names)
            opts.append(out_file.replace(" ", r"\ "))
            shell=True
        opts += get_translator_opts(translator_args) + file_names
        opts = [pyjs.PYTHON] + [os.path.join(pydir, translate_cmd)] + translate_cmd_opts + opts
        pyjscompile_cmd = '"%s"' % '" "'.join(opts)
        #print pyjscompile_cmd - use this to create Makefile code-fragment
        proc = subprocess.Popen(pyjscompile_cmd,
                           stdin=subprocess.PIPE,
                           stdout=subprocess.PIPE,
                           stderr=subprocess.PIPE,
                           shell=shell,
                           cwd=os.path.dirname(file_names[0]),
                           env=os.environ
                           )
        stdout_value, stderr_value = proc.communicate('')
        if stderr_value:
            raise translator.TranslationError(stderr_value, None)

    if translator_args.get('list_imports', None):
        print "List Imports %s:" % platform, file_names
        print stdout_value
        return [], []

    deps, js_libs = parse_outfile(out_file)
    # use this to create dependencies for Makefiles.  maybe.
    #print "translate", out_file, deps, js_libs, stdout_value

    return deps, js_libs
dataset/ETHPy150Open anandology/pyjamas/pyjs/src/pyjs/linker.py/out_translate/original