Try a fix for unmatching dates of acceptable distance

artix-checker
Raymond Li 9 months ago
parent dce2583550
commit 06f5f46bb1
Signed by untrusted user: r389li
GPG Key ID: A014EA89B62BBB1B
  1. 17
      project.py

@ -3,6 +3,7 @@ Contains abstract class for a mirrored project
"""
from abc import ABC
import re
import requests
@ -17,4 +18,18 @@ class Project(ABC):
"""Check if project packages are up-to-date"""
csc_url = CSC_MIRROR + data[project]["csc"] + data[project]["file"]
upstream_url = data[project]["upstream"] + data[project]["file"]
return requests.get(csc_url).text == requests.get(upstream_url).text
CSC = requests.get(csc_url).text
upstream = requests.get(upstream_url).text
if upstream == CSC:
return True
# Parse number differences
bad_re = '[a-zA-Z \-\n]+'
if re.search(bad_re, CSC):
# print(re.search(bad_re, CSC).group().strip())
CSC = re.sub(bad_re, '', CSC)
upstream = re.sub(bad_re, '', upstream)
try:
return int(upstream) - int(CSC) < data[project]["out_of_sync_interval"]
except ValueError:
return False

Loading…
Cancel
Save