Updated compare changelogs

This commit is contained in:
Dimitris Zlatanidis 2024-01-12 21:22:10 +02:00
parent d19cc04882
commit 3f52013234

View file

@ -94,6 +94,7 @@ class CheckUpdates(Configs):
def compare_the_changelogs(self, local_chg_txt: Path, repo_chg_txt: str) -> bool:
local_size: int = 0
repo_size: int = 0
if self.proxy_address.startswith('http'):
self.set_http_proxy_server()
@ -101,20 +102,19 @@ class CheckUpdates(Configs):
if self.proxy_address.startswith('socks'):
self.set_socks_proxy_server()
if local_chg_txt.is_file():
local_size: int = int(os.stat(local_chg_txt).st_size)
try:
repo = self.http.request('GET', repo_chg_txt)
repo_size: int = int(repo.headers.get('content-length', 0))
except KeyboardInterrupt:
raise SystemExit(1)
except HTTPError:
self.error_connect_message(repo_chg_txt)
repo_size: int = 0
else:
repo_size: int = int(repo.headers.get('content-length', 0))
if repo_size == 0:
self.error_connect_message(repo_chg_txt)
if local_chg_txt.is_file():
local_size: int = int(os.stat(local_chg_txt).st_size)
if repo_size == 0:
repo_size: int = local_size
logger = logging.getLogger(LoggingConfig.date_time)
logger.info(f'{self.__class__.__name__}: '