Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mkosi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5199,12 +5199,12 @@ def run_verb(args: Args, tools: Optional[Config], images: Sequence[Config], *, r
if any((c := config).is_incremental() and not have_cache(config) for config in images):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can write this as a regular for loop with a check at the beginning to continue to not have to add the comments I think

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's tracked in this issue and already has a PR

if args.rerun_build_scripts:
die(
f"Cannot use --rerun-build-scripts as the cache for image {c.image} is out-of-date",
f"Cannot use --rerun-build-scripts as the cache for image {c.image} is out-of-date", # ty: ignore[unresolved-reference]
hint="Rebuild the image to update the image cache",
)
else:
die(
f"Strict incremental mode is enabled and cache for image {c.image} is out-of-date",
f"Strict incremental mode is enabled and cache for image {c.image} is out-of-date", # ty: ignore[unresolved-reference]
hint="Build once with '-i yes' to update the image cache",
)

Expand Down
16 changes: 8 additions & 8 deletions mkosi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,7 @@ def from_json(cls, s: Union[str, dict[str, Any], SupportsRead[str], SupportsRead
if isinstance(s, str):
j = json.loads(s)
elif isinstance(s, dict):
j = s
j = s # ty: ignore[invalid-assignment]
elif hasattr(s, "read"):
j = json.load(s)
else:
Expand Down Expand Up @@ -2483,7 +2483,7 @@ def from_partial_json(
if isinstance(s, str):
j = json.loads(s)
elif isinstance(s, dict):
j = s
j = s # ty: ignore[invalid-assignment]
elif hasattr(s, "read"):
j = json.load(s)
else:
Expand Down Expand Up @@ -4611,7 +4611,7 @@ def create_argument_parser(chdir: bool = True) -> argparse.ArgumentParser:
last_section = s.section

if s.short and s.const is not None:
group.add_argument( # type: ignore # needed by pyright
group.add_argument( # type: ignore # ty: ignore[unused-ignore-comment] # needed by pyright
s.short,
metavar="",
dest=s.dest,
Expand All @@ -4624,7 +4624,7 @@ def create_argument_parser(chdir: bool = True) -> argparse.ArgumentParser:
for long in [s.long, *s.compat_longs]:
opts = [s.short, long] if s.short and long == s.long and s.const is None else [long]

group.add_argument( # type: ignore # needed by pyright
group.add_argument( # type: ignore # ty: ignore[unused-ignore-comment] # needed by pyright
*opts,
dest=s.dest,
choices=s.choices,
Expand All @@ -4643,7 +4643,7 @@ def resolve_deps(images: Sequence[Config], include: Sequence[str]) -> list[Confi
graph = {config.image: config.dependencies for config in images}

if any((missing := i) not in graph for i in include):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

die(f"No image found with name {missing}")
die(f"No image found with name {missing}") # ty: ignore[unresolved-reference]

deps = set()
queue = [*include]
Expand Down Expand Up @@ -4823,13 +4823,13 @@ def finalize_value(self, setting: ConfigSetting[T]) -> Optional[T]:
# so we ignore the return-value error for it.
if isinstance(v, list):
assert isinstance(cfg_value, type(v))
return cfg_value + v # type: ignore[return-value] # needed by mypy
return cfg_value + v # type: ignore[return-value] # ty: ignore[unused-ignore-comment] # needed by mypy
elif isinstance(v, dict):
assert isinstance(cfg_value, type(v))
return cfg_value | v # type: ignore[return-value] # needed by mypy
return cfg_value | v # type: ignore[return-value] # ty: ignore[unused-ignore-comment] # needed by mypy
elif isinstance(v, set):
assert isinstance(cfg_value, type(v))
return cfg_value | v # type: ignore[return-value] # needed by mypy
return cfg_value | v # type: ignore[return-value] # ty: ignore[unused-ignore-comment] # needed by mypy
else:
return v

Expand Down