diff --git a/package/share/ahriman/style.jinja2 b/package/share/ahriman/style.jinja2
index 59e8cda3..f4b4ec80 100644
--- a/package/share/ahriman/style.jinja2
+++ b/package/share/ahriman/style.jinja2
@@ -47,7 +47,11 @@
background-color: rgba(235, 235, 255, 1);
}
- tr.header, tr.package:hover {
+ tr.package:hover {
+ background-color: rgba(255, 255, 225, 1);
+ }
+
+ tr.header{
background-color: rgba(200, 200, 255, 1);
}
diff --git a/src/ahriman/application/ahriman.py b/src/ahriman/application/ahriman.py
index cf693afb..400fba9a 100644
--- a/src/ahriman/application/ahriman.py
+++ b/src/ahriman/application/ahriman.py
@@ -113,5 +113,5 @@ if __name__ == '__main__':
parser.print_help()
exit(1)
- with Lock(args.lock, args.force):
+ with Lock(args.lock, args.architecture, args.force):
args.fn(args)
diff --git a/src/ahriman/application/lock.py b/src/ahriman/application/lock.py
index 70e057dc..2cf19bfb 100644
--- a/src/ahriman/application/lock.py
+++ b/src/ahriman/application/lock.py
@@ -17,28 +17,33 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
+from __future__ import annotations
+
import os
-from typing import Optional
+from types import TracebackType
+from typing import Literal, Optional, Type
from ahriman.core.exceptions import DuplicateRun
class Lock:
- def __init__(self, path: Optional[str], force: bool) -> None:
- self.path = path
+ def __init__(self, path: Optional[str], architecture: str, force: bool) -> None:
+ self.path: Optional[str] = f'{path}_{architecture}' if self.path is not None else None
self.force = force
- def __enter__(self):
+ def __enter__(self) -> Lock:
if self.force:
self.remove()
self.check()
self.create()
return self
- def __exit__(self, exc_type, exc_val, exc_tb):
+ def __exit__(self, exc_type: Optional[Type[Exception]], exc_val: Optional[Exception],
+ exc_tb: TracebackType) -> Literal[False]:
self.remove()
+ return False
def check(self) -> None:
if self.path is None:
diff --git a/src/ahriman/core/alpm/pacman.py b/src/ahriman/core/alpm/pacman.py
index af3630c3..c0385a80 100644
--- a/src/ahriman/core/alpm/pacman.py
+++ b/src/ahriman/core/alpm/pacman.py
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
-from pyalpm import Handle
+from pyalpm import Handle # type: ignore
from typing import List, Set
from ahriman.core.configuration import Configuration
diff --git a/src/ahriman/core/report/html.py b/src/ahriman/core/report/html.py
index f970486b..4ec648b4 100644
--- a/src/ahriman/core/report/html.py
+++ b/src/ahriman/core/report/html.py
@@ -20,11 +20,10 @@
import jinja2
import os
-from typing import Dict, Iterable
+from typing import Callable, Dict, Iterable
from ahriman.core.configuration import Configuration
from ahriman.core.report.report import Report
-from ahriman.core.util import package_like
from ahriman.models.package import Package
from ahriman.models.sign_settings import SignSettings
@@ -61,6 +60,7 @@ class HTML(Report):
'version': base.version
} for base in packages for package, filename in base.packages.items()
]
+ comparator: Callable[[Dict[str, str]], str] = lambda item: item['filename']
html = template.render(
architecture=self.architecture,
@@ -68,7 +68,7 @@ class HTML(Report):
link_path=self.link_path,
has_package_signed=SignSettings.SignPackages in self.sign_targets,
has_repo_signed=SignSettings.SignRepository in self.sign_targets,
- packages= sorted(content, key=lambda item: item['filename']),
+ packages=sorted(content, key=comparator),
pgp_key=self.pgp_key,
repository=self.repository)
diff --git a/src/ahriman/core/tree.py b/src/ahriman/core/tree.py
index 7b573c93..9ad6295e 100644
--- a/src/ahriman/core/tree.py
+++ b/src/ahriman/core/tree.py
@@ -56,13 +56,17 @@ class Leaf:
self.package = package
self.dependencies: Set[str] = set()
+ @property
+ def items(self) -> Iterable[str]:
+ return self.package.packages.keys()
+
def is_root(self, packages: Iterable[Leaf]) -> bool:
'''
:param packages:
:return: true if any of packages is dependency of the leaf, false otherwise
'''
for leaf in packages:
- if self.dependencies.intersection(leaf.package.packages.keys()):
+ if self.dependencies.intersection(leaf.items):
return False
return True
diff --git a/src/ahriman/core/util.py b/src/ahriman/core/util.py
index 093e5608..3afe2b67 100644
--- a/src/ahriman/core/util.py
+++ b/src/ahriman/core/util.py
@@ -24,7 +24,7 @@ from typing import Optional
def check_output(*args: str, exception: Optional[Exception],
- cwd = None, stderr: int = subprocess.STDOUT,
+ cwd: Optional[str] = None, stderr: int = subprocess.STDOUT,
logger: Optional[Logger] = None) -> str:
try:
result = subprocess.check_output(args, cwd=cwd, stderr=stderr).decode('utf8').strip()
diff --git a/src/ahriman/models/package.py b/src/ahriman/models/package.py
index 6b1a3123..ffcc35d6 100644
--- a/src/ahriman/models/package.py
+++ b/src/ahriman/models/package.py
@@ -19,13 +19,14 @@
#
from __future__ import annotations
-import aur
+import aur # type: ignore
import os
import shutil
import tempfile
from dataclasses import dataclass
-from srcinfo.parse import parse_srcinfo
+from pyalpm import vercmp # type: ignore
+from srcinfo.parse import parse_srcinfo # type: ignore
from typing import Dict, List, Optional, Set, Type
from ahriman.core.alpm.pacman import Pacman
@@ -137,5 +138,5 @@ class Package:
def is_outdated(self, remote: Package) -> bool:
remote_version = remote.actual_version() # either normal version or updated VCS
- result = check_output('vercmp', self.version, remote_version, exception=None)
- return True if int(result) < 0 else False
+ result: int = vercmp(self.version, remote_version)
+ return result < 0
diff --git a/src/ahriman/web/middlewares/exception_handler.py b/src/ahriman/web/middlewares/exception_handler.py
index 9fa714e1..202fa111 100644
--- a/src/ahriman/web/middlewares/exception_handler.py
+++ b/src/ahriman/web/middlewares/exception_handler.py
@@ -17,15 +17,19 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
-from aiohttp.web import middleware, Request, Response
+from aiohttp.web import middleware, Request
from aiohttp.web_exceptions import HTTPClientError
+from aiohttp.web_response import StreamResponse
from logging import Logger
-from typing import Callable
+from typing import Awaitable, Callable
-def exception_handler(logger: Logger) -> Callable:
+HandlerType = Callable[[Request], Awaitable[StreamResponse]]
+
+
+def exception_handler(logger: Logger) -> Callable[[Request, HandlerType], Awaitable[StreamResponse]]:
@middleware
- async def handle(request: Request, handler: Callable) -> Response:
+ async def handle(request: Request, handler: HandlerType) -> StreamResponse:
try:
return await handler(request)
except HTTPClientError:
diff --git a/src/ahriman/web/views/base.py b/src/ahriman/web/views/base.py
index dac671f2..7399cb9b 100644
--- a/src/ahriman/web/views/base.py
+++ b/src/ahriman/web/views/base.py
@@ -27,4 +27,5 @@ class BaseView(View):
@property
def service(self) -> Watcher:
- return self.request.app['watcher']
+ watcher: Watcher = self.request.app['watcher']
+ return watcher
diff --git a/src/ahriman/web/views/index.py b/src/ahriman/web/views/index.py
index 506c0004..75ef14e3 100644
--- a/src/ahriman/web/views/index.py
+++ b/src/ahriman/web/views/index.py
@@ -17,7 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
-from aiohttp_jinja2 import template
+import aiohttp_jinja2 # type: ignore
+
from typing import Any, Dict
import ahriman.version as version
@@ -27,7 +28,7 @@ from ahriman.web.views.base import BaseView
class IndexView(BaseView):
- @template("build-status.jinja2")
+ @aiohttp_jinja2.template("build-status.jinja2") # type: ignore
async def get(self) -> Dict[str, Any]:
# some magic to make it jinja-friendly
packages = [
diff --git a/src/ahriman/web/web.py b/src/ahriman/web/web.py
index 01b23fa8..fa5bab6f 100644
--- a/src/ahriman/web/web.py
+++ b/src/ahriman/web/web.py
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
-import aiohttp_jinja2
+import aiohttp_jinja2 # type: ignore
import jinja2
import logging