Modernize runtime compatibility and initialize Bearhub fork

This commit is contained in:
Sebastian Palencsar
2026-05-26 08:35:29 +02:00
parent b1ea479a3a
commit d541a4cbcf
23 changed files with 132 additions and 96 deletions

View File

@@ -1,6 +1,6 @@
import os
import traceback
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from logging import Logger
from pathlib import Path
from threading import Thread
@@ -90,13 +90,13 @@ class RepositorySuggestionsDownloader(Thread):
timestamp_str = f.read()
try:
suggestions_timestamp = datetime.fromtimestamp(float(timestamp_str))
suggestions_timestamp = datetime.fromtimestamp(float(timestamp_str), tz=timezone.utc)
except Exception:
self._log.error(f'Could not parse the Arch cached suggestions timestamp: {timestamp_str}')
traceback.print_exc()
return True
update = suggestions_timestamp + timedelta(hours=exp_hours) <= datetime.utcnow()
update = suggestions_timestamp + timedelta(hours=exp_hours) <= datetime.now(timezone.utc)
if update:
self._log.info("The cached suggestions file is no longer valid")
@@ -166,7 +166,7 @@ class RepositorySuggestionsDownloader(Thread):
suggestions = parse(res.text, self._log, 'Arch')
if suggestions:
self._save(text=res.text, timestamp=datetime.utcnow().timestamp())
self._save(text=res.text, timestamp=datetime.now(timezone.utc).timestamp())
else:
self._log.warning(f"Could not parse any Arch suggestion from {self._file_suggestions_ts}")
else: