示例#1
0
def update():
    "Builds gettext and updates 'locale/' directory with new files."

    sphinx_builder = 'gettext'

    conf = lazy_conf(None)
    sconf = get_sconf(conf)
    sconf.builder = sphinx_builder
    sync = StateAttributeDict()

    if 'edition' in sconf:
        conf = edition_setup(sconf.edition, conf)

    # includes_file = os.path.join(conf.paths.branch_source, 'meta', 'includes.txt')
    # if os.path.exists(includes_file):
    #     os.remove(includes_file)

    sphinx_build(builder=sphinx_builder, conf=conf, sconf=sconf, sync=sync, 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')
示例#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")
示例#3
0
def target(*targets):
    "Builds one or more sphinx targets with prerequisites and post-processing."

    conf = lazy_conf()
    sconf = get_sconf(conf)

    sphinx_build(targets, conf, sconf, finalize_build)
示例#4
0
def target(*targets):
    "Builds a sphinx target with prerequisites and post-processing."

    conf = lazy_conf()

    sconf = get_sconf(conf)

    primer_migrate_pages(conf)

    sphinx_build(targets, conf, sconf, finalize_build)
示例#5
0
def update():
    "Builds gettext and updates 'locale/' directory with new files."

    sphinx_builder = 'gettext'

    conf = lazy_conf(None)
    sconf = get_sconf(conf)
    sconf.builder = sphinx_builder
    sync = StateAttributeDict()

    if 'edition' in sconf:
        conf = edition_setup(sconf.edition, conf)

    # includes_file = os.path.join(conf.paths.branch_source, 'meta', 'includes.txt')
    # if os.path.exists(includes_file):
    #     os.remove(includes_file)

    sphinx_build(builder=sphinx_builder, conf=conf, sconf=sconf, sync=sync, finalize_fun=None)
    logger.info('rebuilt gettext targets')

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

    logger.info('updating translation artifacts. Long running.')
    r = command(tx_cmd.format(path=os.path.join(conf.paths.branch_output, sphinx_builder),
                              name='-'.join(conf.project.title.lower().split())),
                capture=True, ignore=True)


    if r.return_code != 0:
        logger.critical('uploading translations failed.')
        logger.warning(r.err)
        raise SystemExit
    else:
        logger.info(r.out)
        logger.info('sphinx_intl completed successfully: translation uploaded.')

    logger.info('sphinx-intl: updated pot directory')
    check()
    logger.info('completed translation file check.')