mirror-checker/distro.py

26 lines
639 B
Python

"""
Contains abstract class for a distro
"""
from abc import ABC, abstractmethod
class Distro(ABC):
"""Abstract class for a distro"""
@staticmethod
@abstractmethod
def name():
"""Get name of distro"""
raise NotImplementedError
@staticmethod
@abstractmethod
def check():
"""Check if distro packages are up-to-date"""
raise NotImplementedError
@classmethod
def print_output(cls, is_successful):
"""Print final output of distro"""
output = "Success: {} up-to-date" if is_successful else "Failure: {} out-of-sync"
print(output.format(cls.name()))