Exemple #1
0
def sphinx_build(targets, conf, sconf, finalize_fun):
    if len(targets) == 0:
        targets.append('html')

    target_jobs = []

    sync = StateAttributeDict()
    for target in targets:
        if target in sconf:
            lsconf = compute_sphinx_config(target, sconf, conf)
            lconf = edition_setup(lsconf.edition, conf)

            target_jobs.append({
                'job': build_worker,
                'args': [ target, lsconf, lconf, sync, finalize_fun],
                'description': "sphinx build worker for {0}".format(target)
            })
        else:
            logger.warning('not building sphinx target {0} without configuration.'.format(target))

    # a batch of prereq jobs go here.
    primer_migrate_pages(conf)
    build_process_prerequsites(sync, conf)

    res = runner(target_jobs, parallel='threads')

    output_sphinx_stream('\n'.join([r[1] if isinstance(r, tuple) else r
                                    for r in res
                                    if r is not None]), conf)

    logger.info('build {0} sphinx targets'.format(len(res)))
Exemple #2
0
def update():
    "Builds gettext and updates 'locale/' directory with new files."

    sphinx_builder = 'gettext'

    conf = lazy_conf(None)
    sconf = compute_sphinx_config(sphinx_builder, get_sconf(conf), conf)
    conf = edition_setup(sconf.edition, conf)

    sphinx_prereq(conf)

    try:
        rm_path = os.path.join(conf.paths.projectroot,
                               conf.paths.branch_source, 'meta',
                               'includes.txt')
        os.remove(rm_path)
        print('[tx]: removed {0}'.format(rm_path))
    except OSError:
        pass

    sphinx_build(builder=sphinx_builder,
                 conf=conf,
                 sconf=sconf,
                 finalize_fun=None)

    print('[tx] [sphinx]: rebuild gettext targets')

    tx_cmd = "sphinx-intl update-txconfig-resources --pot-dir {path} --transifex-project-name={name}"

    command(
        tx_cmd.format(path=os.path.join(conf.paths.branch_output,
                                        sphinx_builder),
                      name='-'.join(conf.project.title.lower().split())))

    print('[tx] [sphinx-intl]: updated pot directory')
Exemple #3
0
def update():
    "Builds gettext and updates 'locale/' directory with new files."

    sphinx_builder = "gettext"

    conf = lazy_conf(None)
    sconf = compute_sphinx_config(sphinx_builder, get_sconf(conf), conf)
    conf = edition_setup(sconf.edition, conf)

    sphinx_prereq(conf)

    try:
        rm_path = os.path.join(conf.paths.projectroot, conf.paths.branch_source, "meta", "includes.txt")
        os.remove(rm_path)
        print("[tx]: removed {0}".format(rm_path))
    except OSError:
        pass

    sphinx_build(builder=sphinx_builder, conf=conf, sconf=sconf, finalize_fun=None)

    print("[tx] [sphinx]: rebuild gettext targets")

    tx_cmd = "sphinx-intl update-txconfig-resources --pot-dir {path} --transifex-project-name={name}"

    command(
        tx_cmd.format(
            path=os.path.join(conf.paths.branch_output, sphinx_builder),
            name="-".join(conf.project.title.lower().split()),
        )
    )

    print("[tx] [sphinx-intl]: updated pot directory")
Exemple #4
0
def sphinx_build(targets, conf, sconf, finalize_fun):
    if len(targets) == 0:
        targets.append('html')

    target_jobs = []

    sync = StateAttributeDict()
    for target in targets:
        if target in sconf:
            lsconf = compute_sphinx_config(target, sconf, conf)
            lconf = edition_setup(lsconf.edition, conf)

            target_jobs.append({
                'job': build_worker,
                'args': [ target, lsconf, lconf, sync, finalize_fun]
            })
        else:
            print('[sphinx] [warning]: not building {0} without configuration.'.format(target))

    # a batch of prereq jobs go here.
    primer_migrate_pages(conf)
    build_process_prerequsites(conf)

    if len(target_jobs) <= 1:
        res = runner(target_jobs, pool=1)
    else:
        res = runner(target_jobs, parallel='threads')

    output_sphinx_stream('\n'.join([r for r in res if r is not None]), conf)

    print('[sphinx]: build {0} sphinx targets'.format(len(res)))
Exemple #5
0
def sphinx_build(targets, conf, sconf, finalize_fun):
    if len(targets) == 0:
        targets.append('html')

    sconf = render_sphinx_config(sconf)

    target_jobs = []

    sync = StateAttributeDict()
    for target in targets:
        if target in sconf:
            lsconf = compute_sphinx_config(target, sconf, conf)
            lconf = edition_setup(lsconf, conf)
            lconf = language_setup(lsconf, lconf)

            target_jobs.append({
                'job':
                build_worker,
                'args': [target, lsconf, lconf, sync, finalize_fun],
                'description':
                "sphinx build worker for {0}".format(target)
            })
        else:
            logger.warning(
                'not building sphinx target {0} without configuration.'.format(
                    target))

    # a batch of prereq jobs go here.
    primer_migrate_pages(conf)
    build_process_prerequsites(sync, conf)

    res = runner(target_jobs, parallel='threads')

    output_sphinx_stream(
        '\n'.join([
            r[1] if isinstance(r, tuple) else r for r in res if r is not None
        ]), conf)

    logger.info('build {0} sphinx targets'.format(len(res)))