Skip to content

Commit

Permalink
interpreter: fix type issues with vcs_tag updates
Browse files Browse the repository at this point in the history
The annotations weren't updated to reflect the changes.
  • Loading branch information
dcbaker committed Dec 6, 2024
1 parent 38051a5 commit 83253cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions mesonbuild/interpreter/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@
import copy

if T.TYPE_CHECKING:
from typing_extensions import Literal

from . import kwargs as kwtypes
from ..backend.backends import Backend
from ..interpreterbase.baseobjects import InterpreterObject, TYPE_var, TYPE_kwargs
Expand Down Expand Up @@ -1986,8 +1988,8 @@ def func_vcs_tag(self, node: mparser.BaseNode, args: T.List['TYPE_var'], kwargs:

install = kwargs['install']
install_mode = self._warn_kwarg_install_mode_sticky(kwargs['install_mode'])
install_dir = [] if kwargs['install_dir'] is None else [kwargs['install_dir']]
install_tag = [] if kwargs['install_tag'] is None else [kwargs['install_tag']]
install_dir: T.List[T.Union[str, Literal[False]]] = [] if kwargs['install_dir'] is None else [kwargs['install_dir']]
install_tag: T.List[T.Optional[str]] = [] if kwargs['install_tag'] is None else [kwargs['install_tag']]
if install and not install_dir:
raise InvalidArguments('vcs_tag: "install_dir" keyword argument must be set when "install" is true.')

Expand Down
6 changes: 5 additions & 1 deletion mesonbuild/interpreter/kwargs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright © 2021 The Meson Developers
# Copyright © 2021 Intel Corporation
# Copyright © 2021-2024 Intel Corporation
from __future__ import annotations

"""Keyword Argument type annotations."""
Expand Down Expand Up @@ -286,6 +286,10 @@ class VcsTag(TypedDict):
build.ExtractedObjects, build.GeneratedList, ExternalProgram, File]]
output: T.List[str]
replace_string: str
install: bool
install_tag: T.Optional[str]
install_dir: T.Optional[str]
install_mode: FileMode


class ConfigureFile(TypedDict):
Expand Down

0 comments on commit 83253cd

Please sign in to comment.