提交 cb4de8f3 编写于 作者: Z zengweifeng

fix the error of function check_metacpan which can only get the latest version

上级 6071b277
...@@ -156,22 +156,25 @@ def check_metacpan(info): ...@@ -156,22 +156,25 @@ def check_metacpan(info):
headers = { headers = {
'User-Agent' : 'Mozilla/5.0 (X11; Linux x86_64)' 'User-Agent' : 'Mozilla/5.0 (X11; Linux x86_64)'
} }
url = urljoin("https://fastapi.metacpan.org/release/", info["src_repo"]) url = urljoin("https://metacpan.org/release/", info["src_repo"])
resp = requests.get(url, headers=headers) resp = requests.get(url, headers=headers)
resp = resp.text resp = resp.text
tags = [] tags = []
result_json = json.loads(resp) tag_list = resp.splitlines()
if result_json != {}: condition = "value=\"/release"
if "version" not in result_json.keys(): for index in range(len(tag_list)):
eprint("{repo} > ERROR FOUND".format(repo=info["src_repo"])) if condition in tag_list[index]:
sys.exit(1) tag = tag_list[index + 1]
else: index = index + 1
tags.append(result_json["version"]) if 'DEV' in tag:
else: continue
tag = tag.lstrip()
tag = tag.rstrip()
tags.append(tag)
if not len(tags):
eprint("{repo} found unsorted on cpan.metacpan.org".format(repo=info["src_repo"])) eprint("{repo} found unsorted on cpan.metacpan.org".format(repo=info["src_repo"]))
sys.exit(1) sys.exit(1)
last_query = {} last_query = {}
last_query["time_stamp"] = datetime.now() last_query["time_stamp"] = datetime.now()
last_query["raw_data"] = resp last_query["raw_data"] = resp
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册