forked from Mirror/pmbootstrap
pmb: Use inspect.get_annotations()
On Python 3.10 and newer, this is the recommended way of accessing annotations[1]. It also works with Mypyc, unlike directly accessing __annotations__. [1]: https://docs.python.org/3/howto/annotations.html Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2634
This commit is contained in:
parent
53f050ef14
commit
0ade6cab4d
2 changed files with 6 additions and 4 deletions
|
@ -5,6 +5,7 @@ from pathlib import Path
|
|||
from pmb.core.context import get_context
|
||||
from pmb.core.arch import Arch
|
||||
from pmb.helpers import logging
|
||||
import inspect
|
||||
import os
|
||||
import pmb.config
|
||||
import pmb.helpers.other
|
||||
|
@ -53,7 +54,7 @@ def _parse_kernel_suffix(info: dict[str, str], device: str, kernel: str | None)
|
|||
ret = copy.copy(info)
|
||||
|
||||
suffix_kernel = kernel.replace("-", "_")
|
||||
for key in Deviceinfo.__annotations__.keys():
|
||||
for key in inspect.get_annotations(Deviceinfo).keys():
|
||||
key_kernel = f"{key}_{suffix_kernel}"
|
||||
if key_kernel not in ret:
|
||||
continue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue