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


Python BuildService.projectAttributeExists方法代码示例

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


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

示例1: ParticipantHandler

# 需要导入模块: from buildservice import BuildService [as 别名]
# 或者: from buildservice.BuildService import projectAttributeExists [as 别名]
class ParticipantHandler(object):

    """ Participant class as defined by the SkyNET API """

    def __init__(self):
        self.obs = None
        self.oscrc = None

    def handle_wi_control(self, ctrl):
        """ job control thread """
        pass

    def handle_lifecycle_control(self, ctrl):
        """ participant control thread """
        if ctrl.message == "start":
            if ctrl.config.has_option("obs", "oscrc"):
                self.oscrc = ctrl.config.get("obs", "oscrc")

    def setup_obs(self, namespace):
        """ setup the Buildservice instance using the namespace as an alias
            to the apiurl """

        self.obs = BuildService(oscrc=self.oscrc, apiurl=namespace)

    def check_and_mark_project(self, project, attribute):
        """
        Checks an OBS project for the existence of attribute needs_nightly_build.
        Return True if the project didn't have one and create the attibute.False
        otherwise.
        """
        if self.obs.projectAttributeExists(project, attribute):
            return False
        else:
            self.obs.createProjectAttribute(project,
                                           attribute)
            return True

    def handle_wi(self, wid):

        """ actual job thread """
        wid.status = False
        wid.fields.needs_build = False

        self.setup_obs(wid.fields.ev.namespace)
        if wid.params.delete:
            stat = self.obs.deleteProjectAttribute(wid.fields.project,
                                           wid.params.attribute)
            if stat:
                wid.status = True
            else:
                wid.status = False
        else:
            if self.check_and_mark_project(wid.fields.project,
                                           wid.params.attribute):
                wid.fields.needs_build = True
            else:
                wid.fields.needs_build = False
开发者ID:MeeGoIntegration,项目名称:boss-standard-workflow,代码行数:59,代码来源:mark_project.py


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