Example #1
0
def run(environ):
    def sandbox_callback(sandbox):
        fpc_cfg = open(os.path.join(sandbox.path, 'fpc.cfg.in')).read()
        fpc_cfg = fpc_cfg.replace('__DIR__', os.path.abspath(sandbox.path))
        open('fpc.cfg', 'w').write(fpc_cfg)

    return common.run(environ=environ,
               lang='pas',
               compiler='fpc',
               extension='pas',
               output_file='a',
               compile_additional_sources=False,
               sandbox=True,
               sandbox_callback=sandbox_callback)
Example #2
0
def run(environ, lang):
    if lang == 'c':
        compiler_exe = 'gcc'
        extension = 'c'
    elif lang == 'cpp':
        compiler_exe = 'g++'
        extension = 'cpp'
    else:
        raise ValueError("Unexpected language name: " + lang)

    return common.run(environ=environ,
               lang=lang,
               compiler=compiler_exe,
               extension=extension,
               output_file='a.out',
               compiler_options=COMPILER_OPTIONS)
Example #3
0
def run(environ, lang, extra_options=[]):
    if lang == 'c':
        compiler_exe = 'gcc'
        extension = 'c'
    elif lang == 'cpp':
        compiler_exe = 'g++'
        extension = 'cpp'
    else:
        raise ValueError("Unexpected language name: " + lang)

    def include_callback(executor, cmd):
        return cmd + ['-I', os.path.join(executor.rpath, 'usr', 'include')]

    return common.run(environ=environ,
               lang=lang,
               compiler=compiler_exe,
               extension=extension,
               output_file='a.out',
               compiler_options=(COMPILER_OPTIONS + extra_options),
               sandbox=True,
               sandbox_callback=include_callback)
Example #4
0
def run(environ, lang):
    if lang == 'c':
        compiler_exe = 'gcc'
        extension = 'c'
    elif lang == 'cpp':
        compiler_exe = 'g++'
        extension = 'cpp'
    else:
        raise ValueError("Unexpected language name: " + lang)

    sandbox = get_sandbox('compiler-' + environ['compiler'])
    compiler_options = \
        ['-I', os.path.join(sandbox.path, 'usr', 'include')] \
        + COMPILER_OPTIONS

    return common.run(environ=environ,
               lang=lang,
               compiler=compiler_exe,
               extension=extension,
               output_file='a.out',
               compiler_options=compiler_options,
               sandbox=sandbox)
Example #5
0
def run(environ):
    return common.run(
        environ=environ, lang="pas", compiler="fpc", extension="pas", output_file="a", compile_additional_sources=False
    )