Ejemplo n.º 1
0
    def run(self):
        self.run_command("build")
        dist = self.distribution

        run_cmd_in_context(InstallCommand, "install", [], CmdContext,
                           dist.run_node, dist.top_node, dist.pkg)

        if self.record:
            self.write_record()
Ejemplo n.º 2
0
def run_dependencies(global_context, cmd_name, run_node, top_node, build_node,
        pkg, package_options):
    cmd_data_db = build_node.make_node(CMD_DATA_DUMP)

    deps = CMD_SCHEDULER.order(cmd_name)
    for cmd_name in deps:
        cmd = global_context.retrieve_command(cmd_name)
        cmd_argv = _get_cmd_data_provider(cmd_data_db).get_argv(cmd_name)
        ctx_klass = CONTEXT_REGISTRY.retrieve(cmd_name)
        run_cmd_in_context(global_context, cmd, cmd_name, cmd_argv, ctx_klass,
                run_node, top_node, pkg, package_options)
Ejemplo n.º 3
0
    def run(self):
        from bento.commands.configure import ConfigureCommand
        from bento.commands.context import ConfigureYakuContext

        dist = self.distribution

        scheme = self._get_install_scheme()
        argv = []
        for k, v in scheme.iteritems():
            if k == "exec_prefix":
                k = "exec-prefix"
            argv.append("--%s=%s" % (k, v))

        run_cmd_in_context(
            ConfigureCommand, "configure", argv, ConfigureYakuContext, dist.run_node, dist.top_node, dist.pkg
        )
Ejemplo n.º 4
0
def run_sdist(context):
    sdist_name = "sdist"
    sdist_klass = COMMANDS_REGISTRY.get_command(sdist_name)
    cmd_argv = []
    sdist_context_klass = CONTEXT_REGISTRY.get(sdist_name)
    sdist, sdist_context = run_cmd_in_context(sdist_klass,
                        sdist_name, cmd_argv, sdist_context_klass,
                        context.run_node, context.top_node, context.pkg)
    return sdist
Ejemplo n.º 5
0
def run_cmd(global_ctx, cmd_name, cmd_opts, run_node, top_node, build_node):
    cmd = global_ctx.retrieve_command(cmd_name)

    # XXX: fix this special casing (commands which do not need a pkg instance)
    if cmd_name in ["help", "convert"]:
        options_ctx = OPTIONS_REGISTRY.retrieve(cmd_name)
        ctx_klass = CONTEXT_REGISTRY.retrieve(cmd_name)
        ctx = ctx_klass(global_ctx, cmd_opts, options_ctx, None, run_node)
        # XXX: hack for help command to get option context for any command
        # without making help depends on bentomakerlib
        ctx.options_registry = OPTIONS_REGISTRY
        cmd.run(ctx)
        return

    bento_info = top_node.find_node(BENTO_SCRIPT)
    if bento_info is None:
        raise UsageException("Error: no %s found !" % os.path.join(top_node.abspath(), BENTO_SCRIPT))

    package_options = __get_package_options(top_node)
    pkg = _get_package_with_user_flags(cmd_name, cmd_opts, package_options, top_node, build_node)
    if is_help_only(cmd_name, cmd_opts):
        options_context = OPTIONS_REGISTRY.retrieve(cmd_name)
        p = options_context.parser
        o, a = p.parse_args(cmd_opts)
        if o.help:
            p.print_help()
    else:
        run_dependencies(global_ctx, cmd_name, run_node, top_node, build_node,
                pkg, package_options)

        ctx_klass = CONTEXT_REGISTRY.retrieve(cmd_name)
        run_cmd_in_context(global_ctx, cmd, cmd_name, cmd_opts, ctx_klass,
                run_node, top_node, pkg, package_options)

        cmd_data_db = build_node.make_node(CMD_DATA_DUMP)
        _set_cmd_data_provider(cmd_name, cmd_opts, cmd_data_db)
Ejemplo n.º 6
0
    def run(self):
        dist = self.distribution

        cmd_argv = ["--output-dir=%s" % self.dist_dir]
        run_cmd_in_context(SdistCommand, "sdist", cmd_argv, CmdContext,
                           dist.run_node, dist.top_node, dist.pkg)
Ejemplo n.º 7
0
    def run(self):
        self.run_command("config")

        dist = self.distribution
        run_cmd_in_context(BuildCommand, "build", [], BuildYakuContext,
                           dist.run_node, dist.top_node, dist.pkg)