From 49c5c1ee332813bfa2dea7144bbeea6380d02334 Mon Sep 17 00:00:00 2001 From: miao_kaibo Date: Tue, 13 Oct 2020 11:57:54 +0800 Subject: [PATCH 01/12] init --- LICENSE | 127 ++++++++++++++++++++++++++++++++++++++++++ __init__.py | 4 ++ common/__init__.py | 4 ++ common/log_obs.py | 30 ++++++++++ config.ini | 0 core/__init__.py | 4 ++ core/runner.py | 29 ++++++++++ log/openeuler-obs.log | 1 + openeuler_obs.py | 24 ++++++++ tools/readme | 1 + 10 files changed, 224 insertions(+) create mode 100644 LICENSE create mode 100644 __init__.py create mode 100644 common/__init__.py create mode 100644 common/log_obs.py create mode 100644 config.ini create mode 100644 core/__init__.py create mode 100644 core/runner.py create mode 100644 log/openeuler-obs.log create mode 100644 openeuler_obs.py create mode 100644 tools/readme diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ee58399 --- /dev/null +++ b/LICENSE @@ -0,0 +1,127 @@ + 木兰宽松许可证, 第2版 + + 木兰宽松许可证, 第2版 + 2020年1月 http://license.coscl.org.cn/MulanPSL2 + + + 您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束: + + 0. 定义 + + “软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。 + + “贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。 + + “贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。 + + “法人实体”是指提交贡献的机构及其“关联实体”。 + + “关联实体”是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。 + + 1. 授予版权许可 + + 每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。 + + 2. 授予专利许可 + + 每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。 + + 3. 无商标许可 + + “本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。 + + 4. 分发限制 + + 您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。 + + 5. 免责声明与责任限制 + + “软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。 + + 6. 语言 + “本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。 + + 条款结束 + + 如何将木兰宽松许可证,第2版,应用到您的软件 + + 如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步: + + 1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字; + + 2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中; + + 3, 请将如下声明文本放入每个源文件的头部注释中。 + + Copyright (c) [Year] [name of copyright holder] + [Software Name] is licensed under 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. + + + Mulan Permissive Software License,Version 2 + + Mulan Permissive Software License,Version 2 (Mulan PSL v2) + January 2020 http://license.coscl.org.cn/MulanPSL2 + + Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions: + + 0. Definition + + Software means the program and related documents which are licensed under this License and comprise all Contribution(s). + + Contribution means the copyrightable work licensed by a particular Contributor under this License. + + Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License. + + Legal Entity means the entity making a Contribution and all its Affiliates. + + Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity. + + 1. Grant of Copyright License + + Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not. + + 2. Grant of Patent License + + Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken. + + 3. No Trademark License + + No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4. + + 4. Distribution Restriction + + You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software. + + 5. Disclaimer of Warranty and Limitation of Liability + + THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + 6. Language + + THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL. + + END OF THE TERMS AND CONDITIONS + + How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software + + To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps: + + i Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner; + + ii Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package; + + iii Attach the statement to the appropriate annotated syntax at the beginning of each source file. + + + Copyright (c) [Year] [name of copyright holder] + [Software Name] is licensed under 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. diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..c134421 --- /dev/null +++ b/__init__.py @@ -0,0 +1,4 @@ +#/bin/env python3 +""" +module init +""" diff --git a/common/__init__.py b/common/__init__.py new file mode 100644 index 0000000..c134421 --- /dev/null +++ b/common/__init__.py @@ -0,0 +1,4 @@ +#/bin/env python3 +""" +module init +""" diff --git a/common/log_obs.py b/common/log_obs.py new file mode 100644 index 0000000..1ac13d9 --- /dev/null +++ b/common/log_obs.py @@ -0,0 +1,30 @@ +#/bin/env python3 +# -*- encoding=utf8 -*- +""" +logger for all scripts +""" +import os +import logging + + +def get_logger(): + """ + get logger object + return: logger object + """ + current_path = os.path.split(os.path.realpath(__file__))[0] + logfile = os.path.join(current_path, "../log", "openeuler-obs.log") + logger = logging.getLogger() + logger.setLevel(logging.DEBUG) + formatter = logging.Formatter('%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s:%(message)s') + file_handler = logging.FileHandler(logfile, mode='w') + file_handler.setLevel(logging.DEBUG) + file_handler.setFormatter(formatter) + stream_handler = logging.StreamHandler() + stream_handler.setLevel(logging.DEBUG) + stream_handler.setFormatter(formatter) + logger.addHandler(stream_handler) + logger.addHandler(file_handler) + return logger + +logger = get_logger() diff --git a/config.ini b/config.ini new file mode 100644 index 0000000..e69de29 diff --git a/core/__init__.py b/core/__init__.py new file mode 100644 index 0000000..c134421 --- /dev/null +++ b/core/__init__.py @@ -0,0 +1,4 @@ +#/bin/env python3 +""" +module init +""" diff --git a/core/runner.py b/core/runner.py new file mode 100644 index 0000000..211cc8c --- /dev/null +++ b/core/runner.py @@ -0,0 +1,29 @@ +#/bin/env python3 +# -*- encoding=utf8 -*- +""" +main script for running +""" + +from common.log_obs import logger + + +class Runner(object): + """ + Runner class for all action + """ + def __init__(self, **kwargs): + """ + init action + kwargs: dict, init dict by "a"="A" style + return: + """ + print(kwargs) + + def run(self): + """ + run main + return: + """ + logger.debug("test") + + diff --git a/log/openeuler-obs.log b/log/openeuler-obs.log new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/log/openeuler-obs.log @@ -0,0 +1 @@ + diff --git a/openeuler_obs.py b/openeuler_obs.py new file mode 100644 index 0000000..4f5c4fe --- /dev/null +++ b/openeuler_obs.py @@ -0,0 +1,24 @@ + #/bin/env python3 +# -*- encoding=utf8 -*- +""" +main script for openeuler-obs +""" +import argparse +import os +import sys +from common.log_obs import logger +from core.runner import Runner + + +#ArgumentParser +par = argparse.ArgumentParser() +par.add_argument("-o", "--obs", help="Local path of obs_meta repository", required=True) +par.add_argument("-b", "--branch", default=None, help="gitee repostory branch name", required=False) +par.add_argument("-p", "--project", default=None, help="obs project name", required=False) +args = par.parse_args() + +#apply +obs_meta_path = args.obs +logger.info(obs_meta_path) +run = Runner(obs_path=args.obs, project=args.project) +run.run() diff --git a/tools/readme b/tools/readme new file mode 100644 index 0000000..d79415b --- /dev/null +++ b/tools/readme @@ -0,0 +1 @@ +some tools not scripts shuld be given here -- Gitee From 855136043b766a0ea214479b5b8fc0219060172b Mon Sep 17 00:00:00 2001 From: miao_kaibo Date: Tue, 13 Oct 2020 12:02:30 +0800 Subject: [PATCH 02/12] update log_obs.py --- common/log_obs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/log_obs.py b/common/log_obs.py index 1ac13d9..58299ea 100644 --- a/common/log_obs.py +++ b/common/log_obs.py @@ -27,4 +27,6 @@ def get_logger(): logger.addHandler(file_handler) return logger + logger = get_logger() + -- Gitee From 471e6339a855d6ecc2e4629fc0402b9e567e4c31 Mon Sep 17 00:00:00 2001 From: miao_kaibo Date: Wed, 14 Oct 2020 09:19:56 +0800 Subject: [PATCH 03/12] delete empty __init__.py --- __init__.py | 4 ---- common/__init__.py | 4 ---- core/__init__.py | 4 ---- 3 files changed, 12 deletions(-) delete mode 100644 __init__.py delete mode 100644 common/__init__.py delete mode 100644 core/__init__.py diff --git a/__init__.py b/__init__.py deleted file mode 100644 index c134421..0000000 --- a/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -#/bin/env python3 -""" -module init -""" diff --git a/common/__init__.py b/common/__init__.py deleted file mode 100644 index c134421..0000000 --- a/common/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -#/bin/env python3 -""" -module init -""" diff --git a/core/__init__.py b/core/__init__.py deleted file mode 100644 index c134421..0000000 --- a/core/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -#/bin/env python3 -""" -module init -""" -- Gitee From ac04e577340be3e32cca43d65214020a91a0e34f Mon Sep 17 00:00:00 2001 From: miao_kaibo Date: Wed, 14 Oct 2020 10:20:53 +0800 Subject: [PATCH 04/12] add config dir --- config.ini => config/config.ini | 0 config/logger.conf | 93 +++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) rename config.ini => config/config.ini (100%) create mode 100644 config/logger.conf diff --git a/config.ini b/config/config.ini similarity index 100% rename from config.ini rename to config/config.ini diff --git a/config/logger.conf b/config/logger.conf new file mode 100644 index 0000000..24e0d48 --- /dev/null +++ b/config/logger.conf @@ -0,0 +1,93 @@ +#logger.conf +############################################### +[loggers] +keys=root,jobs,build,ac,common,no_fmt + +[logger_root] +level=INFO +handlers=hand01 +qualname=root + +[logger_jobs] +level=DEBUG +handlers=hand02 +qualname=jobs + +[logger_build] +level=DEBUG +handlers=hand03 +qualname=build + +[logger_ac] +level=DEBUG +handlers=hand04 +qualname=ac + +[logger_common] +level=DEBUG +handlers=hand100 +qualname=common + +[logger_no_fmt] +level=DEBUG +handlers=hand100,hand101 +qualname=no_fmt +propagate=0 +############################################### +[handlers] +keys=hand01,hand02,hand03,hand04,hand100,hand101 + +[handler_hand01] +class=StreamHandler +level=INFO +formatter=form01 +args=(sys.stderr,) + +[handler_hand02] +class=handlers.RotatingFileHandler +level=DEBUG +formatter=form02 +args=('log/jobs.log', 'a', 10*1024*1024, 5) + +[handler_hand03] +class=handlers.RotatingFileHandler +level=DEBUG +formatter=form02 +args=('log/build.log', 'a', 10*1024*1024, 5) + +[handler_hand04] +class=handlers.RotatingFileHandler +level=DEBUG +formatter=form02 +args=('log/ac.log', 'a', 10*1024*1024, 5) + +[handler_hand100] +class=handlers.RotatingFileHandler +level=DEBUG +formatter=form02 +args=('log/common.log', 'a', 10*1024*1024, 5) + +[handler_hand101] +class=StreamHandler +level=INFO +formatter=form04 +args=(sys.stderr,) +############################################### +[formatters] +keys=form01,form02,form03,form04 + +[formatter_form01] +class=src.utils.color_log.CusColoredFormatter +format=%(log_color)s%(asctime)s [%(levelname)7s] : %(message)s + +[formatter_form02] +format=%(asctime)s %(filename)20s[line:%(lineno)3d] %(levelname)7s : %(message)s +#datefmt=%a, %d %b %Y %H:%M:%S + +[formatter_form03] +format=%(asctime)s [%(levelname)s] : %(message)s +datefmt= + +[formatter_form04] +class=src.utils.color_log.CusColoredFormatter +format=%(log_color)s%(message)s -- Gitee From 2cd05ce6099d77ddce55421dfb691061f49ed5b0 Mon Sep 17 00:00:00 2001 From: miao_kaibo Date: Wed, 14 Oct 2020 10:21:52 +0800 Subject: [PATCH 05/12] delete logger.conf --- config/logger.conf | 93 ---------------------------------------------- 1 file changed, 93 deletions(-) delete mode 100644 config/logger.conf diff --git a/config/logger.conf b/config/logger.conf deleted file mode 100644 index 24e0d48..0000000 --- a/config/logger.conf +++ /dev/null @@ -1,93 +0,0 @@ -#logger.conf -############################################### -[loggers] -keys=root,jobs,build,ac,common,no_fmt - -[logger_root] -level=INFO -handlers=hand01 -qualname=root - -[logger_jobs] -level=DEBUG -handlers=hand02 -qualname=jobs - -[logger_build] -level=DEBUG -handlers=hand03 -qualname=build - -[logger_ac] -level=DEBUG -handlers=hand04 -qualname=ac - -[logger_common] -level=DEBUG -handlers=hand100 -qualname=common - -[logger_no_fmt] -level=DEBUG -handlers=hand100,hand101 -qualname=no_fmt -propagate=0 -############################################### -[handlers] -keys=hand01,hand02,hand03,hand04,hand100,hand101 - -[handler_hand01] -class=StreamHandler -level=INFO -formatter=form01 -args=(sys.stderr,) - -[handler_hand02] -class=handlers.RotatingFileHandler -level=DEBUG -formatter=form02 -args=('log/jobs.log', 'a', 10*1024*1024, 5) - -[handler_hand03] -class=handlers.RotatingFileHandler -level=DEBUG -formatter=form02 -args=('log/build.log', 'a', 10*1024*1024, 5) - -[handler_hand04] -class=handlers.RotatingFileHandler -level=DEBUG -formatter=form02 -args=('log/ac.log', 'a', 10*1024*1024, 5) - -[handler_hand100] -class=handlers.RotatingFileHandler -level=DEBUG -formatter=form02 -args=('log/common.log', 'a', 10*1024*1024, 5) - -[handler_hand101] -class=StreamHandler -level=INFO -formatter=form04 -args=(sys.stderr,) -############################################### -[formatters] -keys=form01,form02,form03,form04 - -[formatter_form01] -class=src.utils.color_log.CusColoredFormatter -format=%(log_color)s%(asctime)s [%(levelname)7s] : %(message)s - -[formatter_form02] -format=%(asctime)s %(filename)20s[line:%(lineno)3d] %(levelname)7s : %(message)s -#datefmt=%a, %d %b %Y %H:%M:%S - -[formatter_form03] -format=%(asctime)s [%(levelname)s] : %(message)s -datefmt= - -[formatter_form04] -class=src.utils.color_log.CusColoredFormatter -format=%(log_color)s%(message)s -- Gitee From d19e473f57a38ebd211e18f5d95f11503b7aa386 Mon Sep 17 00:00:00 2001 From: miao_kaibo Date: Wed, 14 Oct 2020 10:27:20 +0800 Subject: [PATCH 06/12] update log_obs.py --- common/log_obs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/log_obs.py b/common/log_obs.py index 58299ea..c866ff4 100644 --- a/common/log_obs.py +++ b/common/log_obs.py @@ -16,7 +16,8 @@ def get_logger(): logfile = os.path.join(current_path, "../log", "openeuler-obs.log") logger = logging.getLogger() logger.setLevel(logging.DEBUG) - formatter = logging.Formatter('%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s:%(message)s') + formatter = logging.Formatter('%(asctime)s - '\ + '%(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s') file_handler = logging.FileHandler(logfile, mode='w') file_handler.setLevel(logging.DEBUG) file_handler.setFormatter(formatter) @@ -29,4 +30,3 @@ def get_logger(): logger = get_logger() - -- Gitee From a5987740987104e38e8fef68c2c9bef551b96f24 Mon Sep 17 00:00:00 2001 From: miao_kaibo Date: Wed, 14 Oct 2020 10:29:17 +0800 Subject: [PATCH 07/12] update log_obs.py --- common/log_obs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/log_obs.py b/common/log_obs.py index c866ff4..459665a 100644 --- a/common/log_obs.py +++ b/common/log_obs.py @@ -14,7 +14,7 @@ def get_logger(): """ current_path = os.path.split(os.path.realpath(__file__))[0] logfile = os.path.join(current_path, "../log", "openeuler-obs.log") - logger = logging.getLogger() + logger = logging.getLogger("") logger.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - '\ '%(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s') -- Gitee From 721835a29dbaabdf1b5f6c533dafea54e0550a6d Mon Sep 17 00:00:00 2001 From: miao_kaibo Date: Wed, 14 Oct 2020 10:32:42 +0800 Subject: [PATCH 08/12] update log_obs.py --- common/log_obs.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/log_obs.py b/common/log_obs.py index 459665a..3ccf2ef 100644 --- a/common/log_obs.py +++ b/common/log_obs.py @@ -30,3 +30,7 @@ def get_logger(): logger = get_logger() + + +if __name__ == "__main__": + logger.debug("test") -- Gitee From ab2f24874d27e91199ada34691ad9da29f5dc312 Mon Sep 17 00:00:00 2001 From: miao_kaibo Date: Wed, 14 Oct 2020 10:41:10 +0800 Subject: [PATCH 09/12] update log_obs.py --- common/log_obs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/log_obs.py b/common/log_obs.py index 3ccf2ef..3ce15f0 100644 --- a/common/log_obs.py +++ b/common/log_obs.py @@ -29,8 +29,8 @@ def get_logger(): return logger -logger = get_logger() +log = get_logger() if __name__ == "__main__": - logger.debug("test") + log.debug("test") -- Gitee From 87426d309a7cb713f708d0e15d19d85bd73eeea1 Mon Sep 17 00:00:00 2001 From: miao_kaibo Date: Wed, 14 Oct 2020 10:49:04 +0800 Subject: [PATCH 10/12] add --- common/__pycache__/log_obs.cpython-37.pyc | Bin 0 -> 1047 bytes common/log_obs.py | 9 +++++++-- core/__pycache__/runner.cpython-37.pyc | Bin 0 -> 829 bytes core/runner.py | 4 ++-- log/openeuler-obs.log | 3 ++- openeuler_obs.py | 4 ++-- 6 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 common/__pycache__/log_obs.cpython-37.pyc create mode 100644 core/__pycache__/runner.cpython-37.pyc diff --git a/common/__pycache__/log_obs.cpython-37.pyc b/common/__pycache__/log_obs.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..218a2e8f53c4e27b2f93c98d085f7114c79318f1 GIT binary patch literal 1047 zcmZuwO>Yx15ViL!n{ATPmIH{(3aO|$G`SQBMF^n+r3b{NLPAE!+Qe?U>FzqR-2&0( z1mebjNRIp^AK}Db=!vnDszt()$K#oo_r_!IVY{6m7+0s?>H7eo-*$67d~lw_R8PP# zL=eNwD=@)s^@zuO7JNg*=l)kj0v@vP+>-}9SVSyZVvLw~g1U{_y`&K1F_-D7kZD#F zsT#?As#Wp_c+uODwRS`>8!%tMRKLJzG{FncS>M?}hfBN!{rkYZ^yVu>RHG$U1C169 z>tR%-4jsEVfp~Kjzd@{+Ys7qD!8%!NuwaSjUhOSfI+?UB3q(5%^yWT9Hfzix*7)Jg zgF3jufPbg<*XXS!num3GD;r*Cfp@zGE{vQ9TGoT^#Iwgq3S-Q5y6%z~PWVW>sO0)W zR)ha#F!W~@^?H5y*KA8ndBraZF89Sy^&n)>?09!CQzM<1ysOgvba(GGFL;&N?S~?- z_+WR>E|uuAk1k*EOJ1x11Av!YscZ~rgFkh#2};3ucgJ`_nP8gfGZRciUYSr$i(H#n z@~m*-m{O}msfqaKTxn&(@|@+;gt@XyBzY+=xoOz*=GB-q;qY(V3n8%r*OpgJY5w0B=(56Akj^bu!5qTl?LJ#GpfMWyC7l(nw^bxin39 zk!$vrtNCnA-%*Z`uJ=EY+=hN%9rRhIv;H{O{W8x4JOCF{z#OisO+^+dl%C$ zCV}(Om7@LF)FUt`e281_m*50X^lhrpkm?n5~2Sgoj~_&SjQ;`x<|Fn1 literal 0 HcmV?d00001 diff --git a/common/log_obs.py b/common/log_obs.py index 3ce15f0..7e986ee 100644 --- a/common/log_obs.py +++ b/common/log_obs.py @@ -12,8 +12,13 @@ def get_logger(): get logger object return: logger object """ - current_path = os.path.split(os.path.realpath(__file__))[0] - logfile = os.path.join(current_path, "../log", "openeuler-obs.log") + log_path = os.path.join(os.path.split(os.path.realpath(__file__))[0], "../log") + if not os.path.exists(log_path): + os.mkdir(log_path) + elif not os.path.isdir(log_path): + os.remove(log_path) + os.mkdir(log_path) + logfile = os.path.join(log_path, "openeuler-obs.log") logger = logging.getLogger("") logger.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - '\ diff --git a/core/__pycache__/runner.cpython-37.pyc b/core/__pycache__/runner.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7f0aa570448e9f8baf05bb38e9fad3eeceda3278 GIT binary patch literal 829 zcmZ8gy^ho{5Vqqa8^YdQheT(spa_DEXitC+C@7G&fG!1=H}ccS zmjIkIP{+Y&Qc!3WC|WQTD0W2v8o=QhsTf+!hWHI2YTMsWImi_7vX;(`{bXHpS^CPf zW4#1cqhK4<*Pw0=#*P@Rw36k%cGv)Jf`PsSb@+xS zU#OyADeNGC9kBkvVO;3J@k{@<;1s2;5k<#mKlTjN%H1e5Df<*>scfgq@ zjQaF?LP)Q&7+JKk(LxNV5RFm57W}yoA39lIS7t&eQwm{kA^z=uo8bB^cCtthFSLun zBrK#!GUirUWKSS99G9kPOuK|jC}5$}@UdCH*QFm%-kALWJ0wr0v7RA2hyO(w%-J8! C;Jix! literal 0 HcmV?d00001 diff --git a/core/runner.py b/core/runner.py index 211cc8c..99d7dd0 100644 --- a/core/runner.py +++ b/core/runner.py @@ -4,7 +4,7 @@ main script for running """ -from common.log_obs import logger +from common.log_obs import log class Runner(object): @@ -24,6 +24,6 @@ class Runner(object): run main return: """ - logger.debug("test") + log.debug("test") diff --git a/log/openeuler-obs.log b/log/openeuler-obs.log index 8b13789..25e2b3a 100644 --- a/log/openeuler-obs.log +++ b/log/openeuler-obs.log @@ -1 +1,2 @@ - +2020-10-14 10:48:48,555 - openeuler_obs.py[line:22] - INFO: ./ +2020-10-14 10:48:48,555 - runner.py[line:27] - DEBUG: test diff --git a/openeuler_obs.py b/openeuler_obs.py index 4f5c4fe..f82733a 100644 --- a/openeuler_obs.py +++ b/openeuler_obs.py @@ -6,7 +6,7 @@ main script for openeuler-obs import argparse import os import sys -from common.log_obs import logger +from common.log_obs import log from core.runner import Runner @@ -19,6 +19,6 @@ args = par.parse_args() #apply obs_meta_path = args.obs -logger.info(obs_meta_path) +log.info(obs_meta_path) run = Runner(obs_path=args.obs, project=args.project) run.run() -- Gitee From 02940647d05d1f00e7da2ab47d011e3755c3c3e3 Mon Sep 17 00:00:00 2001 From: miao_kaibo Date: Wed, 14 Oct 2020 10:49:46 +0800 Subject: [PATCH 11/12] update --- common/__pycache__/log_obs.cpython-37.pyc | Bin 1047 -> 0 bytes core/__pycache__/runner.cpython-37.pyc | Bin 829 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 common/__pycache__/log_obs.cpython-37.pyc delete mode 100644 core/__pycache__/runner.cpython-37.pyc diff --git a/common/__pycache__/log_obs.cpython-37.pyc b/common/__pycache__/log_obs.cpython-37.pyc deleted file mode 100644 index 218a2e8f53c4e27b2f93c98d085f7114c79318f1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1047 zcmZuwO>Yx15ViL!n{ATPmIH{(3aO|$G`SQBMF^n+r3b{NLPAE!+Qe?U>FzqR-2&0( z1mebjNRIp^AK}Db=!vnDszt()$K#oo_r_!IVY{6m7+0s?>H7eo-*$67d~lw_R8PP# zL=eNwD=@)s^@zuO7JNg*=l)kj0v@vP+>-}9SVSyZVvLw~g1U{_y`&K1F_-D7kZD#F zsT#?As#Wp_c+uODwRS`>8!%tMRKLJzG{FncS>M?}hfBN!{rkYZ^yVu>RHG$U1C169 z>tR%-4jsEVfp~Kjzd@{+Ys7qD!8%!NuwaSjUhOSfI+?UB3q(5%^yWT9Hfzix*7)Jg zgF3jufPbg<*XXS!num3GD;r*Cfp@zGE{vQ9TGoT^#Iwgq3S-Q5y6%z~PWVW>sO0)W zR)ha#F!W~@^?H5y*KA8ndBraZF89Sy^&n)>?09!CQzM<1ysOgvba(GGFL;&N?S~?- z_+WR>E|uuAk1k*EOJ1x11Av!YscZ~rgFkh#2};3ucgJ`_nP8gfGZRciUYSr$i(H#n z@~m*-m{O}msfqaKTxn&(@|@+;gt@XyBzY+=xoOz*=GB-q;qY(V3n8%r*OpgJY5w0B=(56Akj^bu!5qTl?LJ#GpfMWyC7l(nw^bxin39 zk!$vrtNCnA-%*Z`uJ=EY+=hN%9rRhIv;H{O{W8x4JOCF{z#OisO+^+dl%C$ zCV}(Om7@LF)FUt`e281_m*50X^lhrpkm?n5~2Sgoj~_&SjQ;`x<|Fn1 diff --git a/core/__pycache__/runner.cpython-37.pyc b/core/__pycache__/runner.cpython-37.pyc deleted file mode 100644 index 7f0aa570448e9f8baf05bb38e9fad3eeceda3278..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 829 zcmZ8gy^ho{5Vqqa8^YdQheT(spa_DEXitC+C@7G&fG!1=H}ccS zmjIkIP{+Y&Qc!3WC|WQTD0W2v8o=QhsTf+!hWHI2YTMsWImi_7vX;(`{bXHpS^CPf zW4#1cqhK4<*Pw0=#*P@Rw36k%cGv)Jf`PsSb@+xS zU#OyADeNGC9kBkvVO;3J@k{@<;1s2;5k<#mKlTjN%H1e5Df<*>scfgq@ zjQaF?LP)Q&7+JKk(LxNV5RFm57W}yoA39lIS7t&eQwm{kA^z=uo8bB^cCtthFSLun zBrK#!GUirUWKSS99G9kPOuK|jC}5$}@UdCH*QFm%-kALWJ0wr0v7RA2hyO(w%-J8! C;Jix! -- Gitee From eca51b09826db64d429800c736bebf5a5726fe94 Mon Sep 17 00:00:00 2001 From: miao_kaibo Date: Wed, 14 Oct 2020 10:51:06 +0800 Subject: [PATCH 12/12] delete log --- log/openeuler-obs.log | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 log/openeuler-obs.log diff --git a/log/openeuler-obs.log b/log/openeuler-obs.log deleted file mode 100644 index 25e2b3a..0000000 --- a/log/openeuler-obs.log +++ /dev/null @@ -1,2 +0,0 @@ -2020-10-14 10:48:48,555 - openeuler_obs.py[line:22] - INFO: ./ -2020-10-14 10:48:48,555 - runner.py[line:27] - DEBUG: test -- Gitee