本文整理汇总了Python中coprs.logic.builds_logic.BuildsLogic.create_new_from_pypi方法的典型用法代码示例。如果您正苦于以下问题:Python BuildsLogic.create_new_from_pypi方法的具体用法?Python BuildsLogic.create_new_from_pypi怎么用?Python BuildsLogic.create_new_from_pypi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coprs.logic.builds_logic.BuildsLogic
的用法示例。
在下文中一共展示了BuildsLogic.create_new_from_pypi方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_new_build_pypi
# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import create_new_from_pypi [as 别名]
def process_new_build_pypi(copr, add_view, url_on_success):
form = forms.BuildFormPyPIFactory(copr.active_chroots)()
if form.validate_on_submit():
build_options = {
"enable_net": form.enable_net.data,
"timeout": form.timeout.data,
}
try:
BuildsLogic.create_new_from_pypi(
flask.g.user,
copr,
form.pypi_package_name.data,
form.pypi_package_version.data,
form.python_versions.data,
form.selected_chroots,
**build_options
)
db.session.commit()
except (ActionInProgressException, InsufficientRightsException) as e:
db.session.rollback()
flask.flash(str(e), "error")
else:
flask.flash("New build has been created.")
return flask.redirect(url_on_success)
else:
return render_add_build_pypi(copr, form, add_view)
示例2: factory
# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import create_new_from_pypi [as 别名]
def factory(**build_options):
BuildsLogic.create_new_from_pypi(
flask.g.user,
copr,
form.pypi_package_name.data,
form.pypi_package_version.data,
form.python_versions.data,
form.selected_chroots,
**build_options
)
示例3: copr_new_build_pypi
# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import create_new_from_pypi [as 别名]
def copr_new_build_pypi(copr):
form = forms.BuildFormPyPIFactory(copr.active_chroots)(csrf_enabled=False)
# TODO: automatically prepopulate all form fields with their defaults
if not form.python_versions.data:
form.python_versions.data = form.python_versions.default
# 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: {0}".format(form.errors))
# create a new build
try:
build = BuildsLogic.create_new_from_pypi(
flask.g.user,
copr,
form.pypi_package_name.data,
form.pypi_package_version.data,
form.python_versions.data,
form.selected_chroots,
)
db.session.commit()
except (ActionInProgressException, InsufficientRightsException) as e:
raise LegacyApiError("Invalid request: {}".format(e))
output = {"output": "ok",
"ids": [build.id],
"message": "Build was added to {0}.".format(copr.name)}
return flask.jsonify(output)
示例4: main
# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import create_new_from_pypi [as 别名]
def main():
updated_packages = get_updated_packages(get_updates_messages())
loginfo('Updated packages according to datagrepper: {0}'.format(updated_packages))
for row in get_copr_package_info_rows():
source_json = json.loads(row.source_json)
source_package_name = source_json['pypi_package_name'].lower()
source_python_versions = source_json['python_versions']
latest_build_version = row.pkg_version
loginfo('candidate package for rebuild: {0}, package_id: {1}, copr_id: {2}'.format(source_package_name, row.package_id, row.copr_id))
if source_package_name in updated_packages:
new_updated_version = updated_packages[source_package_name]
logdebug('source_package_name: {0}, latest_build_version: {1}, new_updated_version {2}'.format(source_package_name, latest_build_version, new_updated_version))
if not latest_build_version or not re.match(new_updated_version, latest_build_version): # if the last build's package version is "different" from new remote package version, rebuild
try:
copr = CoprsLogic.get_by_id(row.copr_id)[0]
except Exception as e:
logexception(e)
continue
if args.backend.lower() == 'pypi':
loginfo('Launching pypi build for package of source name: {0}, package_id: {1}, copr_id: {2}, user_id: {3}'.format(source_package_name, row.package_id, copr.id, copr.user.id))
build = BuildsLogic.create_new_from_pypi(copr.user, copr, source_package_name, new_updated_version, source_python_versions, chroot_names=None)
else:
raise Exception('Unsupported backend {0} passed as command-line argument'.format(args.backend))
db.session.commit()
loginfo('Launched build id {0}'.format(build.id))
示例5: create_new_build
# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import create_new_from_pypi [as 别名]
def create_new_build():
return BuildsLogic.create_new_from_pypi(
flask.g.user,
copr,
form.pypi_package_name.data,
form.pypi_package_version.data,
form.python_versions.data,
form.selected_chroots,
)
示例6: build
# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import create_new_from_pypi [as 别名]
def build(self, copr, new_updated_version):
return BuildsLogic.create_new_from_pypi(copr.user, copr, self.name, new_updated_version, self.python_versions, chroot_names=None)