Esempio n. 1
0
def build_port(port_name):
    if port_name in PORT_VARIANTS:
        port_name, extra_settings = PORT_VARIANTS[port_name]
        old_settings = settings.dict().copy()
        for key, value in extra_settings.items():
            setattr(settings, key, value)
    else:
        old_settings = None

    ports.build_port(port_name, settings)
    if old_settings:
        settings.dict().update(old_settings)
Esempio n. 2
0
def get_port_variant(name):
    if name in PORT_VARIANTS:
        name, extra_settings = PORT_VARIANTS[name]
        old_settings = settings.dict().copy()
        for key, value in extra_settings.items():
            setattr(settings, key, value)
    else:
        old_settings = None

    yield name

    if old_settings:
        settings.dict().update(old_settings)
Esempio n. 3
0
def compile_settings():
    stderr_file = os.environ.get('EMCC_STDERR_FILE')
    if stderr_file:
        stderr_file = os.path.abspath(stderr_file)
        logger.info('logging stderr in js compiler phase into %s' %
                    stderr_file)
        stderr_file = open(stderr_file, 'w')

    # Save settings to a file to work around v8 issue 1579
    with shared.configuration.get_temp_files().get_file(
            '.txt') as settings_file:
        with open(settings_file, 'w') as s:
            json.dump(settings.dict(), s, sort_keys=True)

        # Call js compiler
        env = os.environ.copy()
        env['EMCC_BUILD_DIR'] = os.getcwd()
        out = shared.run_js_tool(path_from_root('src/compiler.js'),
                                 [settings_file],
                                 stdout=subprocess.PIPE,
                                 stderr=stderr_file,
                                 cwd=path_from_root('src'),
                                 env=env)
    assert '//FORWARDED_DATA:' in out, 'Did not receive forwarded data in pre output - process failed?'
    glue, forwarded_data = out.split('//FORWARDED_DATA:')
    return glue, forwarded_data
Esempio n. 4
0
def compile_settings():
    stderr_file = os.environ.get('EMCC_STDERR_FILE')
    if stderr_file:
        stderr_file = os.path.abspath(stderr_file)
        logger.info('logging stderr in js compiler phase into %s' %
                    stderr_file)
        stderr_file = open(stderr_file, 'w')

    # Only the names of the legacy settings are used by the JS compiler
    # so we can reduce the size of serialized json by simplifying this
    # otherwise complex value.
    settings['LEGACY_SETTINGS'] = [l[0] for l in settings['LEGACY_SETTINGS']]

    # Save settings to a file to work around v8 issue 1579
    with shared.configuration.get_temp_files().get_file(
            '.json') as settings_file:
        with open(settings_file, 'w') as s:
            json.dump(settings.dict(), s, sort_keys=True, indent=2)

        # Call js compiler
        env = os.environ.copy()
        env['EMCC_BUILD_DIR'] = os.getcwd()
        out = shared.run_js_tool(path_from_root('src/compiler.js'),
                                 [settings_file],
                                 stdout=subprocess.PIPE,
                                 stderr=stderr_file,
                                 cwd=path_from_root('src'),
                                 env=env)
    assert '//FORWARDED_DATA:' in out, 'Did not receive forwarded data in pre output - process failed?'
    glue, forwarded_data = out.split('//FORWARDED_DATA:')
    return glue, forwarded_data