diff --git a/Helper/project_helper.py b/Helper/project_helper.py index 296b392ff199f6d0cf563b1e6da1435530d5136f..37658e5411d0d1fbcdcf31380be374f5f568c42d 100644 --- a/Helper/project_helper.py +++ b/Helper/project_helper.py @@ -16,9 +16,11 @@ This is a wiki bot tool for assisting community governance # Create: 2022-05-16 # Description: This is a wiki bot tool for assisting community governance # ******************************************************************************/ +from model.Issue import Issue, IssueStatus + from utils.log import logger from utils.weblib import get_all_pattern_strings_from_a_url -from utils.constant import SRC_OPENEULER +from utils.constant import SRC_OPENEULER, GITEE FORMAT_ISSUE = r"(src-openeuler/{}/issues/.*\?from=project-issue)" @@ -30,7 +32,12 @@ class ProjectHelp(object): @staticmethod def get_all_issues(project): logger.info("Start to get all issues of a project.") - PATTERN_ISSUE = FORMAT_ISSUE.format(project.get_name()) - issue_strings = get_all_pattern_strings_from_a_url(SRC_OPENEULER + project.get_name() + "/issues", PATTERN_ISSUE) + issues = [] + patten_issue = FORMAT_ISSUE.format(project.get_name()) + issue_strings = get_all_pattern_strings_from_a_url(SRC_OPENEULER + project.get_name() + "/issues", patten_issue) print(issue_strings) + for e in issue_strings: + issue = Issue('', GITEE + e, IssueStatus.OPEN) + issues.append(issue) logger.info("End to get all issues of a project.") + return issues diff --git a/Helper/sig_helper.py b/Helper/sig_helper.py index 26b194b528bf435226e5774929126b519b0007db..2d1507d851a0a5146e6f8512413adff499502808 100644 --- a/Helper/sig_helper.py +++ b/Helper/sig_helper.py @@ -57,7 +57,8 @@ class SigHelper(object): SigHelper.get_all_project_names(sig_list) for sig in sig_list: for project in sig.get_projects(): - ProjectHelp.get_all_issues(project) + issues = ProjectHelp.get_all_issues(project) + project.add_issue(issues) logger.info("End to get sig info.") @staticmethod diff --git a/model/Issue.py b/model/Issue.py index 153bf58b424d30bdc6de7ba1a81dfe7404508fcb..8fd5b64e4b513f9e22b60b2f3dc21d892912b5a0 100644 --- a/model/Issue.py +++ b/model/Issue.py @@ -16,7 +16,7 @@ This is a wiki bot tool for assisting community governance # Create: 2021-01-12 # Description: This is a wiki bot tool for assisting community governance # ******************************************************************************/ - +from enum import Enum class Issue(object): @@ -35,3 +35,10 @@ class Issue(object): def get_url(self): return self.__url + +class IssueStatus(Enum): + OPEN = 1 + PROGRESSING = 2 + CLOSED = 3 + REJECTED = 4 + diff --git a/report/__init__.py b/report/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c59b0f27b5644f883cbcf5b705f82db604b0d527 --- /dev/null +++ b/report/__init__.py @@ -0,0 +1,18 @@ +#!/usr/bin/python3 +""" +This is a wiki bot tool for assisting community governance +""" +# ****************************************************************************** +# Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved. +# licensed under the Mulan PSL v2. +# You can use this software according to the terms and conditions of the Mulan PSL v2. +# You may obtain a copy of Mulan PSL v2 at: +# http://license.coscl.org.cn/MulanPSL2 +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR +# PURPOSE. +# See the Mulan PSL v2 for more details. +# Author: Sinever +# Create: 2022-05-20 +# Description: This is a wiki bot tool for assisting community governance +# ******************************************************************************/ \ No newline at end of file