forked from public/mirror-checker
parent
908d7f200e
commit
bae3d74f00
@ -1,3 +0,0 @@ |
||||
"""Contains shared constants""" |
||||
|
||||
CSC_MIRROR = "http://mirror.csclub.uwaterloo.ca/" |
@ -0,0 +1,21 @@ |
||||
""" |
||||
Contains Eclipse class |
||||
""" |
||||
|
||||
from distro import Distro |
||||
from shared import CSC_MIRROR, get_sec |
||||
|
||||
class Eclipse(Distro): |
||||
"""Eclipse class""" |
||||
@staticmethod |
||||
def name(): |
||||
"""Get name of Eclipse""" |
||||
return "Eclipse" |
||||
|
||||
@staticmethod |
||||
def check(): |
||||
"""Check if Eclipse packages are up-to-date""" |
||||
official_sec = get_sec("http://download.eclipse.org/TIME") |
||||
csc_sec = get_sec(f"{CSC_MIRROR}eclipse/TIME") |
||||
# Out-of-sync by 2 days maximum |
||||
return official_sec < csc_sec + 172800 |
@ -0,0 +1,10 @@ |
||||
"""Contains shared constants and functions""" |
||||
|
||||
import requests |
||||
|
||||
CSC_MIRROR = "http://mirror.csclub.uwaterloo.ca/" |
||||
|
||||
def get_sec(timestamp_file_url): |
||||
"""Get seconds since the Epoch from timestamp file""" |
||||
sec_str = requests.get(timestamp_file_url).text |
||||
return int(sec_str) |
Loading…
Reference in new issue