def deploy(args): conf = fetch_config(args) conf.runstate.package_path = fetch_package(conf.runstate.package_path, conf) logger.info('extracting package: ' + conf.runstate.package_path) new_conf = extract_package(conf) logger.info('extracted package') app = BuildApp(new_conf) logger.info('beginning deploy now.') deploy_tasks(conf, app) if conf.runstate.dry_run is False: app.run()
def deploy(args): conf = fetch_config(args) conf.runstate.package_path = fetch_package(conf.runstate.package_path, conf) logger.info('extracting package: ' + conf.runstate.package_path) extract_package(conf) logger.info('extracted package') app = libgiza.app.BuildApp.new(pool_type=conf.runstate.runner, pool_size=conf.runstate.pool_size, force=conf.runstate.force) logger.info('beginning deploy now.') deploy_tasks(conf, app) if conf.runstate.dry_run is False: app.run()
def deploy(args): conf = fetch_config(args) conf.runstate.package_path = fetch_package(conf.runstate.package_path, conf) logger.info('extracting package: ' + conf.runstate.package_path) extract_package(conf) logger.info('extracted package') app = giza.libgiza.app.BuildApp.new(pool_type=conf.runstate.runner, pool_size=conf.runstate.pool_size, force=conf.runstate.force) logger.info('beginning deploy now.') deploy_tasks(conf, app) if conf.runstate.dry_run is False: app.run()
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 = {"languages": set(), "editions": set(), "builders": set()} push_opts = {"targets": set(), "type": None} packaging_opts = {} sphinx_builders = available_sphinx_builders() if 'push' in conf.system.files.data: deploy_configs = dict( (item['target'], item) for item in conf.system.files.data.push) else: deploy_configs = [] 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 = '-'.join((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) 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)) app = BuildApp.new(pool_type=conf.runstate.runner, force=conf.runstate.force, pool_size=conf.runstate.pool_size) 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_publication(conf, 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']) deploy_tasks(conf, app) derive_command('deploy', conf) if packaging_opts in tasks: derive_command('env', conf) app.add( Task(job=env_package_worker, args=(conf.runstate, conf), target=True, dependency=None)) if len(app.queue) >= 1: app.run()
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 = {"languages": set(), "editions": set(), "builders": set()} push_opts = {"targets": set(), "type": None} packaging_opts = {} sphinx_builders = avalible_sphinx_builders() deploy_configs = dict((item['target'], item) for item in 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 = '-'.join((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) 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)) app = BuildApp.new(pool_type=conf.runstate.runner, force=conf.runstate.force, pool_size=conf.runstate.pool_size) 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_publication(conf, 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']) deploy_tasks(conf, app) derive_command('deploy', conf) if packaging_opts in tasks: derive_command('env', conf) app.add(Task(job=env_package_worker, args=(conf.runstate, conf), target=True, dependency=None)) if len(app.queue) >= 1: app.run()