当前位置: 首页>>代码示例>>Python>>正文


Python BuildsLogic.create_new_from_url方法代码示例

本文整理汇总了Python中coprs.logic.builds_logic.BuildsLogic.create_new_from_url方法的典型用法代码示例。如果您正苦于以下问题:Python BuildsLogic.create_new_from_url方法的具体用法?Python BuildsLogic.create_new_from_url怎么用?Python BuildsLogic.create_new_from_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在coprs.logic.builds_logic.BuildsLogic的用法示例。


在下文中一共展示了BuildsLogic.create_new_from_url方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: factory

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import create_new_from_url [as 别名]
 def factory(**build_options):
     pkgs = form.pkgs.data.split("\n")
     for pkg in pkgs:
         BuildsLogic.create_new_from_url(
             flask.g.user, copr, pkg,
             chroot_names=form.selected_chroots,
             **build_options
         )
     for pkg in pkgs:
         flask.flash("New build has been created: {}".format(pkg), "success")
开发者ID:RadimS97,项目名称:copr,代码行数:12,代码来源:coprs_builds.py

示例2: create_new_build

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import create_new_from_url [as 别名]
 def create_new_build():
     # create separate build for each package
     pkgs = form.pkgs.data.split("\n")
     return [BuildsLogic.create_new_from_url(
         flask.g.user, copr,
         srpm_url=pkg,
         chroot_names=form.selected_chroots,
     ) for pkg in pkgs]
开发者ID:RadimS97,项目名称:copr,代码行数:10,代码来源:api_general.py

示例3: process_new_build_url

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import create_new_from_url [as 别名]
def process_new_build_url(copr, add_view, url_on_success):
    form = forms.BuildFormFactory.create_form_cls(copr.active_chroots)()

    if form.validate_on_submit():
        pkgs = form.pkgs.data.split("\n")

        if not pkgs:
            flask.flash("No builds submitted")
        else:
            # # check which chroots we need
            # chroots = []
            # for chroot in copr.active_chroots:
            #     if chroot.name in form.selected_chroots:
            #         chroots.append(chroot)

            # build each package as a separate build
            try:
                for pkg in pkgs:
                    build_options = {
                        "enable_net": form.enable_net.data,
                        "timeout": form.timeout.data,
                    }
                    BuildsLogic.create_new_from_url(
                        flask.g.user, copr, pkg,
                        chroot_names=form.selected_chroots,
                        **build_options
                    )

            except (ActionInProgressException, InsufficientRightsException) as e:
                flask.flash(str(e), "error")
                db.session.rollback()
            else:
                for pkg in pkgs:
                    flask.flash("New build has been created: {}".format(pkg))

                db.session.commit()

        return flask.redirect(url_on_success)
    else:
        return render_add_build(copr, form, add_view)
开发者ID:evilkost,项目名称:copr,代码行数:42,代码来源:coprs_builds.py

示例4: copr_new_build

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import create_new_from_url [as 别名]
def copr_new_build(copr):

    form = forms.BuildFormFactory.create_form_cls(
        copr.active_chroots)(csrf_enabled=False)

    # are there any arguments in POST which our form doesn't know?
    if any([post_key not in form.__dict__.keys()
            for post_key in flask.request.form.keys()]):
        raise LegacyApiError("Unknown arguments passed (non-existing chroot probably)")

    if not form.validate_on_submit():
        raise LegacyApiError("Invalid request: bad request parameters")

    if not flask.g.user.can_build_in(copr):
        raise LegacyApiError("Invalid request: user {} is not allowed to build in the copr: {}"
                             .format(flask.g.user.username, copr))

    # we're checking authorization above for now
    # and also creating separate build for each package
    pkgs = form.pkgs.data.split("\n")

    ids = []
    for pkg in pkgs:
        try:
            build = BuildsLogic.create_new_from_url(
                flask.g.user, copr,
                srpm_url=pkg,
                chroot_names=form.selected_chroots,
            )
            db.session.commit()
        except ActionInProgressException as err:
            db.session.rollback()

            raise LegacyApiError("Cannot create new build due to: {}".format(err))
        except InsufficientRightsException as err:
            db.session.rollback()
            raise LegacyApiError("User {} cannot create build in project {}: {}"
                                 .format(flask.g.user.username, copr.full_name, err))

        ids.append(build.id)

    output = {"output": "ok",
              "ids": ids,
              "message": "Build was added to {0}.".format(copr.name)}

    return flask.jsonify(output)
开发者ID:evilkost,项目名称:copr,代码行数:48,代码来源:api_general.py


注:本文中的coprs.logic.builds_logic.BuildsLogic.create_new_from_url方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。