Exemple #1
0
def steps(args):
    c = fetch_config(args)

    with BuildApp.context(c) as app:
        if c.runstate.clean_generated is True:
            step_clean(c, app)
        else:
            app.extend_queue(step_tasks(c))
Exemple #2
0
def options(args):
    c = fetch_config(args)

    if c.runstate.clean_generated is True:
        option_clean(c)
    else:
        with BuildApp.context(c) as app:
            app.extend_queue(option_tasks(c))
Exemple #3
0
def tables(args):
    c = fetch_config(args)

    with BuildApp.context(c) as app:
        if c.runstate.clean_generated is True:
            table_clean(c, app)
        else:
            table_tasks(c, app)
Exemple #4
0
def redirects(args):
    c = fetch_config(args)

    if args.dry_run is True:
        print(''.join(make_redirect(c)))
    else:
        with BuildApp.context(c) as app:
            redirect_tasks(c, app)
Exemple #5
0
def primer(args):
    c = fetch_config(args)

    with BuildApp.context(c) as app:
        if c.runstate.clean_generated is True:
            primer_clean(c, app)
        else:
            primer_migration_tasks(c, app)
Exemple #6
0
def intersphinx(args):
    c = fetch_config(args)

    with BuildApp.context(c) as app:
        if c.runstate.clean_generated is True:
            intersphinx_clean(c, app)
        else:
            intersphinx_tasks(c, app)
Exemple #7
0
def images(args):
    c = fetch_config(args)
    app = BuildApp(c)

    with BuildApp.context(c) as app:
        if c.runstate.clean_generated is True:
            image_clean(c, app)
        else:
            image_tasks(c, app)
Exemple #8
0
def source(args):
    conf = fetch_config(args)

    sconf = render_sconf(args.edition, 'html', args.language, conf)
    with BuildApp.context(conf) as app:
        with app.context(conf) as prep_app:
            source_tasks(conf, sconf, prep_app)

        build_content_generation_tasks(conf, app.add('app'))
        refresh_dependency_tasks(conf, app.add('app'))
Exemple #9
0
def run_make_operations(targets, conf):
    """
    :param list targets: A list of tuples in the form of ``(<action>, [option,
         option])`` that define build targets.

    :param Configuration conf: The top level configuration object.

    Parses the ``targets`` list and runs tasks defined, including all specified
    sphinx targets, all ``push`` deployment targets, and will create the ``env``
    packages. Noteworthy behavior:

    - The order of options *except* for the action in the first option is not
      important.

    - If you run ``push`` target with the ``deploy`` option
      (i.e. ``push-deploy`` or ``push-<edition>-deploy``), ``giza`` will *not*
      run the ``publish`` Sphinx build.

    - This interface assumes that all deployment targets (defined in each
      project begin with ``push-`` or ``stage-``.) If you have a project with
      different deployment targets, you will need to call ``giza deploy``
      directly.

    - The ``env`` cache targets take the same options as the Sphinx builders and
      package the environment for only those builders. If you specify ``env``
      after a Sphinx target, ``giza`` will build the cache for only that
      package.
    """

    sphinx_opts = {
        "worker": sphinx_publication,
        "languages": set(),
        "editions": set(),
        "builders": set()
    }
    push_opts = {"worker": deploy_tasks, "targets": set(), "type": None}
    packaging_opts = {}

    sphinx_builders = avalible_sphinx_builders()
    deploy_configs = dict_from_list('target', conf.system.files.data.push)

    tasks = []
    for action, options in targets:
        if action in sphinx_builders:
            tasks.append(sphinx_opts)

            add_sphinx_build_options(sphinx_opts, action, options, conf)
        elif action in ('stage', 'push'):
            tasks.append(push_opts)
            push_opts['type'] = action

            if 'deploy' not in options:
                sphinx_opts['builders'].add('publish')
                tasks.append(sphinx_opts)
                add_sphinx_build_options(sphinx_opts, action, options, conf)
                conf.runstate.fast = False

            if action in deploy_configs:
                push_opts['targets'].add(action)

            for build_option in options:
                deploy_target_name = hyph_concat(action, build_option)

                if build_option in deploy_configs:
                    push_opts['targets'].add(build_option)
                elif deploy_target_name in deploy_configs:
                    push_opts['targets'].add(deploy_target_name)
        elif action.startswith('env'):
            if len(packaging_opts) > 0:
                packaging_opts = copy.copy(sphinx_opts)
                packaging_opts['worker'] = env_package_worker

            tasks.append(packaging_opts)
            add_sphinx_build_options(packaging_opts, False, options, conf)
        else:
            logger.error(
                'target: {0} not defined in the make interface'.format(action))

    with BuildApp.context(conf) as app:
        if sphinx_opts in tasks:
            conf.runstate.languages_to_build = list(sphinx_opts['languages'])
            conf.runstate.editions_to_build = list(sphinx_opts['editions'])
            conf.runstate.builder = list(sphinx_opts['builders'])

            if 'publish' in conf.runstate.builder:
                conf.runstate.fast = False

            derive_command('sphinx', conf)

            sphinx_opts['worker'](conf, conf.runstate, app)

        if push_opts in tasks:
            if len(push_opts['targets']) == 0:
                for lang, edition in itertools.product(
                        conf.runstate.languages_to_build,
                        conf.runstate.editions_to_build):
                    push_target_name = [push_opts['type']]
                    for opt in (edition, lang):
                        if opt is not None:
                            push_target_name.append(opt)
                    push_target_name = '-'.join(push_target_name)
                    push_opts['targets'].add(push_target_name)

            conf.runstate.push_targets = list(push_opts['targets'])
            push_opts['worker'](conf, app)
            derive_command('deploy', conf)

        if packaging_opts in tasks:
            derive_command('env', conf)

            task = app.add('task')
            task.job = env_package_worker
            task.args = (conf.runstate, conf)
            task.target = False
            task.dependency = False
Exemple #10
0
def toc(args):
    c = fetch_config(args)

    with BuildApp.context(c) as app:
        for task in toc_tasks(c):
            app.add(task)
Exemple #11
0
def robots(args):
    c = fetch_config(args)

    with BuildApp.context(c) as app:
        app.pool = 'serial'
        robots_txt_tasks(c, app)
Exemple #12
0
def examples(args):
    c = fetch_config(args)

    with BuildApp.context(c) as app:
        app.extend_queue(example_tasks(c))