提交 2515236f 编写于 作者: S Shinwell Hu

clean up pylint warning of oa_upgradable.py

上级 2aacfdfe
......@@ -2,16 +2,13 @@
"""
This is a script to check upgradable information against upstream
"""
from pyrpm.spec import Spec, replace_macros
import yaml
import json
import datetime
import sys
import os
import sys
import argparse
import urllib.error
from pyrpm.spec import Spec, replace_macros
import yaml
import gitee
import check_upstream
......@@ -22,7 +19,8 @@ def _get_rec_excpt():
"""
Get except case of version recommend
"""
y_file = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "helper/ver_rec_excpt.yaml"))
y_file = open(os.path.join(os.path.dirname(os.path.abspath(__file__)),
"helper/ver_rec_excpt.yaml"))
excpt = yaml.load(y_file, Loader=yaml.Loader)
return excpt
......@@ -31,10 +29,10 @@ def _filter_except(excpts, sources):
"""
Filter except case in sources
"""
for e in excpts:
sources = [s for s in sources if e not in s]
for exp in excpts:
sources = [s for s in sources if exp not in s]
return sources
def get_ver_tags(gt, repo, cwd_path=None):
"""
......@@ -44,7 +42,8 @@ def get_ver_tags(gt, repo, cwd_path=None):
try:
repo_yaml = open(os.path.join(cwd_path, repo + ".yaml")).read()
except FileNotFoundError:
print("WARNING: {pkg}.yaml can't be found in local path: {path}.".format(pkg=repo, path=cwd_path))
print("WARNING: {pkg}.yaml can't be found in local path: {path}.".format(pkg=repo,
path=cwd_path))
repo_yaml = gt.get_yaml(repo)
else:
repo_yaml = gt.get_yaml(repo)
......@@ -84,18 +83,21 @@ def get_ver_tags(gt, repo, cwd_path=None):
excpt_list = _get_rec_excpt()
if repo in excpt_list:
tags = _filter_except(excpt_list[repo], tags)
tags = _filter_except(excpt_list[repo], tags)
return tags
if __name__ == "__main__":
def main():
"""
Main entrance of the functionality
"""
parameters = argparse.ArgumentParser()
parameters.add_argument("-p", "--push", action="store_true",
help="Push the version bump as an issue to src-openeuler repository")
help="Push the version bump as an issue to src-openeuler repository")
parameters.add_argument("-d", "--default", type=str, default=os.getcwd(),
help="The fallback place to look for YAML information")
help="The fallback place to look for YAML information")
parameters.add_argument("repo", type=str,
help="Repository to be checked for upstream version info")
help="Repository to be checked for upstream version info")
args = parameters.parse_args()
......@@ -140,4 +142,10 @@ Please consider upgrading.
Yours openEuler Advisor.
If you think this is not proper issue, Please visit https://gitee.com/openeuler/openEuler-Advisor.
Issues and feedbacks are welcome.""".format(repo=args.repo, ver=ver_rec.latest_version, cur_ver=cur_version))
Issues and feedbacks are welcome.""".format(repo=args.repo,
ver=ver_rec.latest_version,
cur_ver=cur_version))
if __name__ == "__main__":
main()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册