Switch to using fmf.ContextDimension#4894
Conversation
Signed-off-by: Cristian Le <git@lecris.dev>
Signed-off-by: Cristian Le <git@lecris.dev>
Signed-off-by: Cristian Le <git@lecris.dev>
There was a problem hiding this comment.
Code Review
This pull request introduces a custom TmtContext to replace the standard fmf.context.Context, updating dependencies to fmf>=1.8.0 and adjusting various components to use the new implementation. Feedback focuses on ensuring the new context correctly inherits from DistroContext and maintains standard dimension matching logic. Specifically, TmtContextDimension should not redefine _registrar as it hides standard dimensions like arch and distro, and TmtContext should inherit from DistroContext to leverage distribution-aware logic. Additionally, the uv-pre-commit hooks should not be commented out, and the new context plugin registry requires proper integration with the fmf dimensions registrar to function.
| class TmtContextDimension(ContextDimension[T], Generic[T]): | ||
| _default_dimension_cls = TmtDefaultContextDimension | ||
| _registrar = {} |
There was a problem hiding this comment.
Defining _registrar = {} in TmtContextDimension hides all standard dimensions (e.g., arch, distro, os) registered in the base fmf.context.ContextDimension. This will cause TmtContext to lose special matching logic for these dimensions. Remove the explicit registrar definition to inherit the standard one.
| class TmtContextDimension(ContextDimension[T], Generic[T]): | |
| _default_dimension_cls = TmtDefaultContextDimension | |
| _registrar = {} | |
| class TmtContextDimension(ContextDimension[T], Generic[T]): | |
| _default_dimension_cls = TmtDefaultContextDimension |
| _registrar = {} | ||
|
|
||
|
|
||
| class TmtContext(Context): |
There was a problem hiding this comment.
One typo in the title and it thinks cows grow on trees 🙄
| # - repo: https://github.com/astral-sh/uv-pre-commit | ||
| # rev: 0.10.9 | ||
| # hooks: | ||
| # # Keep pyproject.toml and uv.lock in sync | ||
| # - id: uv-lock | ||
| # # Keep pylock.toml in sync | ||
| # - id: uv-export | ||
| # args: | ||
| # - "--frozen" | ||
| # - "--format=pylock.toml" | ||
| # - "--output-file=pylock.toml" | ||
| # - "--all-extras" | ||
| # - "--quiet" |
| @@ -0,0 +1,31 @@ | |||
| from typing import Generic, TypeVar | |||
|
|
|||
| from fmf.context import Context, ContextDimension, DefaultContextDimension | |||
There was a problem hiding this comment.
Import DistroContext from fmf.context to align with the pull request title and leverage the new distribution-aware context logic introduced in fmf 1.8.0.
| from fmf.context import Context, ContextDimension, DefaultContextDimension | |
| from fmf.context import Context, ContextDimension, DefaultContextDimension, DistroContext |
There was a problem hiding this comment.
☝️ this is the kind of stuff I have to cope with weekly wit Gemini
| _CONTEXT_REGISTRY = PluginRegistry('context') | ||
| provides_context = _CONTEXT_REGISTRY.create_decorator() |
|
/packit build |
fmf.DistroContextfmf.ContextDimension
Depends-on teemtee/fmf#293