def prepare_package(top_node, bento_info, backend=None): package = PackageDescription.from_string(bento_info) package_options = PackageOptions.from_string(bento_info) create_fake_package_from_bento_info(top_node, bento_info) top_node.make_node("bento.info").safe_write(bento_info) return create_global_context(package, package_options, backend)
def _prepare_command(run_node, bento_info, cmd_klass, context_klass, cmd_argv): top_node = run_node._ctx.srcnode top_node.make_node("bento.info").safe_write(bento_info) package = PackageDescription.from_string(bento_info) package_options = PackageOptions.from_string(bento_info) cmd = cmd_klass() options_context = OptionsContext.from_command(cmd) cmd.register_options(options_context, package_options) global_context = GlobalContext(None) global_context.register_package_options(package_options) context = context_klass(global_context, cmd_argv, options_context, package, run_node) return context, cmd
def prepare_configure(run_node, bento_info, context_klass=ConfigureYakuContext, cmd_argv=None): if cmd_argv is None: cmd_argv = [] top_node = run_node._ctx.srcnode top_node.make_node("bento.info").safe_write(bento_info) package = PackageDescription.from_string(bento_info) package_options = PackageOptions.from_string(bento_info) configure = ConfigureCommand() opts = OptionsContext.from_command(configure) # FIXME: this emulates the big ugly hack inside bentomaker. _setup_options_parser(opts, package_options) context = context_klass(None, cmd_argv, opts, package, run_node) context.package_options = package_options return context, configure