本文整理匯總了Python中coprs.logic.packages_logic.PackagesLogic.build_package方法的典型用法代碼示例。如果您正苦於以下問題:Python PackagesLogic.build_package方法的具體用法?Python PackagesLogic.build_package怎麽用?Python PackagesLogic.build_package使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類coprs.logic.packages_logic.PackagesLogic
的用法示例。
在下文中一共展示了PackagesLogic.build_package方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: copr_build_package
# 需要導入模塊: from coprs.logic.packages_logic import PackagesLogic [as 別名]
# 或者: from coprs.logic.packages_logic.PackagesLogic import build_package [as 別名]
def copr_build_package(copr, package_name):
form = forms.BuildFormRebuildFactory.create_form_cls(copr.active_chroots)(csrf_enabled=False)
try:
package = PackagesLogic.get(copr.id, package_name)[0]
except IndexError:
raise LegacyApiError("No package with name {name} in copr {copr}".format(name=package_name, copr=copr.name))
if form.validate_on_submit():
try:
build = PackagesLogic.build_package(flask.g.user, copr, package, form.selected_chroots, **form.data)
db.session.commit()
except (InsufficientRightsException, ActionInProgressException, NoPackageSourceException) as e:
raise LegacyApiError(str(e))
else:
raise LegacyApiError(form.errors)
return flask.jsonify({
"output": "ok",
"ids": [build.id],
"message": "Build was added to {0}.".format(copr.name)
})