Updated for checking repos

This commit is contained in:
Dimitris Zlatanidis 2024-03-21 23:03:35 +02:00
parent a93d9ef49d
commit a2da102c79

View file

@ -55,7 +55,12 @@ class CheckUpdates(Configs):
self.repos.repositories[repo]['changelog_txt'])
repo_chg_txt: str = (f"{self.repos.repositories[repo]['mirror'][0]}"
f"{self.repos.repositories[repo]['changelog_txt']}")
self.compare[repo] = self.compare_the_changelogs(local_chg_txt, repo_chg_txt)
repo_data_file: Path = Path(self.repos.repositories_path, repo, self.repos.data_json)
if not repo_data_file.is_file() or not local_chg_txt.is_file():
self.compare[repo]: dict = True
else:
self.compare[repo] = self.compare_the_changelogs(local_chg_txt, repo_chg_txt)
def compare_the_changelogs(self, local_chg_txt: Path, repo_chg_txt: str) -> bool:
local_size: int = 0
@ -83,7 +88,6 @@ class CheckUpdates(Configs):
except HTTPError:
self.error_connect_message(repo_chg_txt)
# Return False if repository changelog file size failed to get a value.
if repo_size == 0:
return False
@ -105,7 +109,6 @@ class CheckUpdates(Configs):
self.http = SOCKSProxyManager(f'{self.proxy_address}', headers=self.proxy_default_headers)
def view_messages(self, compare: dict) -> None:
print()
repo_for_update: list = []
for repo, comp in compare.items():
if comp:
@ -120,7 +123,7 @@ class CheckUpdates(Configs):
print(f'> {self.bgreen}{repo:<{repo_length}}{self.endc} Last Updated: '
f"'{last_updates.get(repo, None)}'")
else:
print(f'\n{self.endc}{self.yellow}No updated packages since the last check.{self.endc}')
print(f'\n\n{self.endc}{self.yellow}No updated packages since the last check.{self.endc}')
def updates(self) -> None:
message: str = 'Checking for news, please wait...'