コード例 #1
0
def get_runtime_versions():
    from dmoj.executors import executors

    return {
        name: clazz.Executor.get_runtime_versions()
        for name, clazz in executors.items()
    }
コード例 #2
0
def get_runtime_versions():
    from dmoj.executors import executors

    def get_ver(clazz):
        raw = list(clazz.Executor.get_runtime_versions())
        pathlib.Path('/tmp/src').mkdir(parents=True, exist_ok=True)
        exe = clazz.Executor('self_test', clazz.Executor.test_program.encode(), _dir='/tmp/src')
        if hasattr(exe, 'get_compile_args'):
            try:
                cmd = exe.get_compile_args()
                cmd = [c.decode() if isinstance(c, bytes) else c for c in cmd]
                raw += [('Compilation command: ' + ' '.join(cmd), tuple())]
            except NotImplementedError:
                pass
        mem = '[MEMORY_LIMIT]'
        cmd = exe.get_cmdline(memory=0, orig_memory=mem)
        raw += [('Execution command: ' + ' '.join(cmd), tuple())]
        print(raw)
        return raw

    return {name: get_ver(clazz) for name, clazz in executors.items()}