1
0
mirror of synced 2026-04-30 23:08:51 +08:00

Merge pull request #105 from Abeautifulsnow/main

Fix bug: 新旧host比对内容不对
This commit is contained in:
削微寒
2021-11-05 11:21:57 +08:00
committed by GitHub

View File

@@ -68,11 +68,13 @@ def write_file(hosts_content: str, update_time: str):
template_path = os.path.join(os.path.dirname(__file__), template_path = os.path.join(os.path.dirname(__file__),
"README_template.md") "README_template.md")
write_host_file(hosts_content) write_host_file(hosts_content)
if os.path.exists(output_doc_file_path):
with open(output_doc_file_path, "r") as old_readme_fb: with open(output_doc_file_path, "r") as old_readme_fb:
old_content = old_readme_fb.read() old_content = old_readme_fb.read()
old_hosts = old_content.split("```bash")[1].split("```")[0].strip() old_hosts = old_content.split("```bash")[1].split("```")[0].strip()
old_hosts = old_hosts.split("# Update time:")[0] old_hosts = old_hosts.split("# Update time:")[0].strip()
if old_hosts == hosts_content: hosts_content_hosts = hosts_content.split("# Update time:")[0].strip()
if old_hosts == hosts_content_hosts:
print("host not change") print("host not change")
return False return False