diff --git a/mesonbuild/_typing.py b/mesonbuild/_typing.py index 8336c46bd06d..aed89f11e438 100644 --- a/mesonbuild/_typing.py +++ b/mesonbuild/_typing.py @@ -19,6 +19,7 @@ T = typing.TypeVar('T') +T_co = typing.TypeVar('T_co', covariant=True) class StringProtocol(Protocol): @@ -43,27 +44,56 @@ class ImmutableListProtocol(Protocol[T]): def __iter__(self) -> typing.Iterator[T]: ... @typing.overload - def __getitem__(self, index: int) -> T: ... + def __getitem__(self, index: int, /) -> T: ... @typing.overload - def __getitem__(self, index: slice) -> typing.List[T]: ... + def __getitem__(self, index: slice, /) -> typing.List[T]: ... - def __contains__(self, item: T) -> bool: ... + def __contains__(self, item: T, /) -> bool: ... def __reversed__(self) -> typing.Iterator[T]: ... def __len__(self) -> int: ... - def __add__(self, other: typing.List[T]) -> typing.List[T]: ... + def __add__(self, other: typing.List[T], /) -> typing.List[T]: ... - def __eq__(self, other: typing.Any) -> bool: ... - def __ne__(self, other: typing.Any) -> bool: ... - def __le__(self, other: typing.Any) -> bool: ... - def __lt__(self, other: typing.Any) -> bool: ... - def __gt__(self, other: typing.Any) -> bool: ... - def __ge__(self, other: typing.Any) -> bool: ... + def __eq__(self, other: typing.Any, /) -> bool: ... + def __ne__(self, other: typing.Any, /) -> bool: ... + def __le__(self, other: typing.Any, /) -> bool: ... + def __lt__(self, other: typing.Any, /) -> bool: ... + def __gt__(self, other: typing.Any, /) -> bool: ... + def __ge__(self, other: typing.Any, /) -> bool: ... - def count(self, item: T) -> int: ... + def count(self, item: T, /) -> int: ... - def index(self, item: T) -> int: ... + def index(self, item: T, /) -> int: ... def copy(self) -> typing.List[T]: ... + + +class Sequence(Protocol[T_co]): + + """A Sequence like type that does not allow str. + + There are times where one wants to use a string as a sequence, but in that + case it would be better to write a `str | Sequence[str]` to be explicit. + + This works because the `__contains__` method for `str` doesn't accept `object`. + """ + + @typing.overload + def __getitem__(self, index: typing.SupportsIndex, /) -> T_co: ... + + @typing.overload + def __getitem__(self, index: slice, /) -> typing.Sequence[T_co]: ... + + def __contains__(self, value: object, /) -> bool: ... + + def __len__(self) -> int: ... + + def __iter__(self) -> typing.Iterator[T_co]: ... + + def index(self, value: typing.Any, start: int = 0, stop: int = ..., /) -> int: ... + + def count(self, value: typing.Any, /) -> int: ... + + def __reversed__(self) -> typing.Iterator[T_co]: ... diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 0b6400732af7..231ff6caf386 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -39,7 +39,7 @@ from typing_extensions import Literal, TypedDict from . import environment - from ._typing import ImmutableListProtocol + from ._typing import ImmutableListProtocol, Sequence from .backend.backends import Backend from .compilers import Compiler from .interpreter.interpreter import SourceOutputs, Interpreter @@ -449,7 +449,7 @@ def __repr__(self) -> str: return r.format(self.__class__.__name__, self.target.name, self.srclist) @staticmethod - def get_sources(sources: T.Sequence['FileOrString'], generated_sources: T.Sequence['GeneratedTypes']) -> T.List['FileOrString']: + def get_sources(sources: Sequence['FileOrString'], generated_sources: Sequence['GeneratedTypes']) -> T.List['FileOrString']: # Merge sources and generated sources sources = list(sources) for gensrc in generated_sources: @@ -462,7 +462,7 @@ def get_sources(sources: T.Sequence['FileOrString'], generated_sources: T.Sequen # Filter out headers and all non-source files return [s for s in sources if is_source(s)] - def classify_all_sources(self, sources: T.List[FileOrString], generated_sources: T.Sequence['GeneratedTypes']) -> T.Dict['Compiler', T.List['FileOrString']]: + def classify_all_sources(self, sources: T.List[FileOrString], generated_sources: Sequence['GeneratedTypes']) -> T.Dict['Compiler', T.List['FileOrString']]: sources_ = self.get_sources(sources, generated_sources) return classify_unity_sources(self.target.compilers.values(), sources_) @@ -1590,7 +1590,7 @@ def add_pch(self, language: str, pchlist: T.List[str]) -> None: raise MesonException(f'File {f} does not exist.') self.pch[language] = pchlist - def add_include_dirs(self, args: T.Sequence['IncludeDirs'], set_is_system: T.Optional[str] = None) -> None: + def add_include_dirs(self, args: Sequence['IncludeDirs'], set_is_system: T.Optional[str] = None) -> None: ids: T.List['IncludeDirs'] = [] for a in args: if not isinstance(a, IncludeDirs): @@ -1798,7 +1798,7 @@ def process_vs_module_defs_kw(self, kwargs: T.Dict[str, T.Any]) -> None: 'a file object, a Custom Target, or a Custom Target Index') self.process_link_depends(path) - def extract_targets_as_list(self, kwargs: T.Dict[str, T.Union[LibTypes, T.Sequence[LibTypes]]], key: T.Literal['link_with', 'link_whole']) -> T.List[LibTypes]: + def extract_targets_as_list(self, kwargs: T.Dict[str, T.Union[LibTypes, Sequence[LibTypes]]], key: T.Literal['link_with', 'link_whole']) -> T.List[LibTypes]: bl_type = self.environment.coredata.optstore.get_value_for(OptionKey('default_both_libraries')) if bl_type == 'auto': if isinstance(self, StaticLibrary): @@ -2791,7 +2791,7 @@ class CommandBase: dependencies: T.List[T.Union[BuildTarget, 'CustomTarget']] subproject: str - def flatten_command(self, cmd: T.Sequence[T.Union[str, File, programs.ExternalProgram, BuildTargetTypes]]) -> \ + def flatten_command(self, cmd: Sequence[T.Union[str, File, programs.ExternalProgram, BuildTargetTypes]]) -> \ T.List[T.Union[str, File, BuildTarget, CustomTarget, programs.ExternalProgram]]: cmd = listify(cmd) final_cmd: T.List[T.Union[str, File, BuildTarget, 'CustomTarget']] = [] @@ -2859,10 +2859,10 @@ def __init__(self, subdir: str, subproject: str, environment: environment.Environment, - command: T.Sequence[T.Union[ + command: Sequence[T.Union[ str, BuildTargetTypes, GeneratedList, programs.ExternalProgram, File]], - sources: T.Sequence[T.Union[ + sources: Sequence[T.Union[ str, File, BuildTargetTypes, ExtractedObjects, GeneratedList, programs.ExternalProgram]], outputs: T.List[str], @@ -2871,8 +2871,8 @@ def __init__(self, build_by_default: T.Optional[bool] = None, capture: bool = False, console: bool = False, - depend_files: T.Optional[T.Sequence[FileOrString]] = None, - extra_depends: T.Optional[T.Sequence[T.Union[str, SourceOutputs]]] = None, + depend_files: T.Optional[Sequence[FileOrString]] = None, + extra_depends: T.Optional[Sequence[T.Union[str, SourceOutputs]]] = None, depfile: T.Optional[str] = None, env: T.Optional[EnvironmentVariables] = None, feed: bool = False, @@ -3121,8 +3121,8 @@ class RunTarget(Target, CommandBase): typename = 'run' def __init__(self, name: str, - command: T.Sequence[T.Union[str, File, BuildTargetTypes, programs.ExternalProgram]], - dependencies: T.Sequence[T.Union[Target, CustomTargetIndex]], + command: Sequence[T.Union[str, File, BuildTargetTypes, programs.ExternalProgram]], + dependencies: Sequence[T.Union[Target, CustomTargetIndex]], subdir: str, subproject: str, environment: environment.Environment, @@ -3171,7 +3171,7 @@ class AliasTarget(RunTarget): typename = 'alias' - def __init__(self, name: str, dependencies: T.Sequence[Target], + def __init__(self, name: str, dependencies: Sequence[Target], subdir: str, subproject: str, environment: environment.Environment): super().__init__(name, [], dependencies, subdir, subproject, environment) diff --git a/mesonbuild/modules/_qt.py b/mesonbuild/modules/_qt.py index 7d52842f9dd4..07499b43edce 100644 --- a/mesonbuild/modules/_qt.py +++ b/mesonbuild/modules/_qt.py @@ -22,6 +22,8 @@ from ..programs import NonExistingExternalProgram if T.TYPE_CHECKING: + from .._typing import Sequence + from . import ModuleState from ..dependencies.qt import QtPkgConfigDependency, QmakeQtDependency from ..interpreter import Interpreter @@ -39,7 +41,7 @@ class ResourceCompilerKwArgs(TypedDict): """Keyword arguments for the Resource Compiler method.""" name: T.Optional[str] - sources: T.Sequence[T.Union[FileOrString, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList]] + sources: Sequence[T.Union[FileOrString, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList]] extra_args: T.List[str] method: str @@ -47,7 +49,7 @@ class UICompilerKwArgs(TypedDict): """Keyword arguments for the Ui Compiler method.""" - sources: T.Sequence[T.Union[FileOrString, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList]] + sources: Sequence[T.Union[FileOrString, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList]] extra_args: T.List[str] method: str preserve_paths: bool @@ -56,8 +58,8 @@ class MocCompilerKwArgs(TypedDict): """Keyword arguments for the Moc Compiler method.""" - sources: T.Sequence[T.Union[FileOrString, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList]] - headers: T.Sequence[T.Union[FileOrString, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList]] + sources: Sequence[T.Union[FileOrString, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList]] + headers: Sequence[T.Union[FileOrString, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList]] extra_args: T.List[str] method: str include_directories: T.List[T.Union[str, build.IncludeDirs]] @@ -98,8 +100,8 @@ class CompileTranslationsKwArgs(TypedDict): class GenQrcKwArgs(TypedDict): - sources: T.Sequence[File] - aliases: T.Sequence[str] + sources: Sequence[File] + aliases: Sequence[str] prefix: str output: str @@ -108,9 +110,9 @@ class GenQmldirKwArgs(TypedDict): module_name: str module_version: str module_prefix: str - qml_sources: T.Sequence[T.Union[FileOrString, build.GeneratedTypes]] - qml_singletons: T.Sequence[T.Union[FileOrString, build.GeneratedTypes]] - qml_internals: T.Sequence[T.Union[FileOrString, build.GeneratedTypes]] + qml_sources: Sequence[T.Union[FileOrString, build.GeneratedTypes]] + qml_singletons: Sequence[T.Union[FileOrString, build.GeneratedTypes]] + qml_internals: Sequence[T.Union[FileOrString, build.GeneratedTypes]] designer_supported: bool imports: T.List[str] optional_imports: T.List[str] @@ -122,7 +124,7 @@ class GenQmldirKwArgs(TypedDict): class GenQmlCachegenKwArgs(TypedDict): target_name: str - qml_sources: T.Sequence[T.Union[FileOrString, build.GeneratedTypes]] + qml_sources: Sequence[T.Union[FileOrString, build.GeneratedTypes]] qml_qrc: T.Union[FileOrString, build.GeneratedTypes] extra_args: T.List[str] module_prefix: str @@ -146,7 +148,7 @@ class GenQmlTypeRegistrarKwArgs(TypedDict): class MocJsonCollectKwArgs(TypedDict): target_name: str - moc_json: T.Sequence[build.GeneratedList] + moc_json: Sequence[build.GeneratedList] method: str class QmlModuleKwArgs(TypedDict): @@ -327,7 +329,7 @@ def _qrc_nodes(state: ModuleState, rcc_file: FileOrString) -> T.Tuple[str, T.Lis def _parse_qrc_deps(self, state: ModuleState, rcc_file_: T.Union[FileOrString, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList]) -> T.List[File]: result: T.List[File] = [] - inputs: T.Sequence['FileOrString'] = [] + inputs: Sequence['FileOrString'] = [] if isinstance(rcc_file_, (str, File)): inputs = [rcc_file_] else: @@ -745,7 +747,7 @@ def compile_translations(self, state: ModuleState, args: T.Tuple, kwargs: Compil else: return ModuleReturnValue(translations, [translations]) - def _source_to_files(self, state: ModuleState, sources: T.Sequence[T.Union[FileOrString, build.GeneratedTypes]]) -> T.List[File]: + def _source_to_files(self, state: ModuleState, sources: Sequence[T.Union[FileOrString, build.GeneratedTypes]]) -> T.List[File]: content_files = [] for s in sources: @@ -803,7 +805,7 @@ def _gen_qmldir(self, state: ModuleState, kwargs: GenQmldirKwArgs) -> File: with open(fileout_abs, 'w', encoding='utf-8') as fd: - def __gen_import(import_type: str, importlist: T.Sequence[str]) -> None: + def __gen_import(import_type: str, importlist: Sequence[str]) -> None: for import_string in importlist: match = import_re.match(import_string) if not match: @@ -812,7 +814,7 @@ def __gen_import(import_type: str, importlist: T.Sequence[str]) -> None: version: str = match.group(4) or '' fd.write(f'{import_type} {module} {version}\n') - def __gen_declaration(qualifier: str, version: str, importlist: T.Sequence[T.Union[FileOrString, build.GeneratedTypes]]) -> None: + def __gen_declaration(qualifier: str, version: str, importlist: Sequence[T.Union[FileOrString, build.GeneratedTypes]]) -> None: importpathlist = self._source_to_files(state, importlist) for s in importpathlist: basename: str = os.path.basename(s.fname) @@ -853,7 +855,7 @@ def _moc_json_collect(self, state: ModuleState, kwargs: MocJsonCollectKwArgs) -> self.tools['moc'].name + ' not found') target_name: str = kwargs['target_name'] - moc_json: T.Sequence[build.GeneratedList] = kwargs['moc_json'] + moc_json: Sequence[build.GeneratedList] = kwargs['moc_json'] #there may be a better way :-/ input_args: T.List[str] = [] @@ -936,7 +938,7 @@ def _qml_type_registrar(self, state: ModuleState, kwargs: GenQmlTypeRegistrarKwA target_name: str = kwargs['target_name'] collected_json: T.Optional[T.Union[FileOrString, build.CustomTarget]] = kwargs['collected_json'] - inputs: T.Sequence[T.Union[FileOrString, build.CustomTarget]] = [collected_json] if collected_json else [] + inputs: Sequence[T.Union[FileOrString, build.CustomTarget]] = [collected_json] if collected_json else [] outputs: T.List[str] = [f'{target_name}_qmltyperegistrations.cpp'] install_dir: T.List[T.Union[str, Literal[False]]] = [False] install_tag: T.List[T.Union[str, None]] = [None] @@ -1051,7 +1053,7 @@ def qml_module(self, state: ModuleState, args: T.Tuple[str], kwargs: QmlModuleKw target_name = re.sub(r'[^A-Za-z0-9]', '_', module_name) qrc_resouces: T.List[T.Union[FileOrString, build.GeneratedTypes]] = [] - all_qml: T.Sequence[T.Union[FileOrString, build.GeneratedTypes]] = kwargs['qml_sources'] + kwargs['qml_singletons'] + kwargs['qml_internals'] + all_qml: Sequence[T.Union[FileOrString, build.GeneratedTypes]] = kwargs['qml_sources'] + kwargs['qml_singletons'] + kwargs['qml_internals'] all_qml_files: T.List[File] = self._source_to_files(state, all_qml) all_qml_basename: T.List[str] = [os.path.basename(p.fname) for p in all_qml_files] diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 70b1165a2fd0..b0d864177579 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -39,6 +39,7 @@ if T.TYPE_CHECKING: from typing_extensions import Literal, TypeAlias, TypedDict + from .._typing import Sequence from . import ModuleState from ..build import BuildTarget from ..compilers import Compiler @@ -546,7 +547,7 @@ def compile_resources(self, state: 'ModuleState', args: T.Tuple[str, 'FileOrStri @staticmethod def _get_gresource_dependencies( state: 'ModuleState', input_file: str, source_dirs: T.List[str], - dependencies: T.Sequence[T.Union[mesonlib.File, CustomTarget, CustomTargetIndex]] + dependencies: Sequence[T.Union[mesonlib.File, CustomTarget, CustomTargetIndex]] ) -> T.Tuple[T.List[mesonlib.FileOrString], T.List[T.Union[CustomTarget, CustomTargetIndex]], T.List[str]]: cmd = ['glib-compile-resources', @@ -619,7 +620,7 @@ def _get_gresource_dependencies( def _get_link_args(self, state: 'ModuleState', lib: T.Union[build.SharedLibrary, build.StaticLibrary], - depends: T.Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]], + depends: Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]], include_rpath: bool = False, use_gir_args: bool = False ) -> T.Tuple[T.List[str], T.List[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]]]: @@ -648,9 +649,9 @@ def _get_link_args(self, state: 'ModuleState', return link_command, new_depends def _get_dependencies_flags_raw( - self, deps: T.Sequence[T.Union['Dependency', build.BuildTarget, CustomTarget, CustomTargetIndex]], + self, deps: Sequence[T.Union['Dependency', build.BuildTarget, CustomTarget, CustomTargetIndex]], state: 'ModuleState', - depends: T.Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]], + depends: Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]], include_rpath: bool, use_gir_args: bool, ) -> T.Tuple[OrderedSet[str], OrderedSet[T.Union[str, T.Tuple[str, str]]], OrderedSet[T.Union[str, T.Tuple[str, str]]], OrderedSet[str], @@ -741,9 +742,9 @@ def fix_ldflags(ldflags: T.Iterable[T.Union[str, T.Tuple[str, str]]]) -> Ordered return cflags, internal_ldflags, external_ldflags, gi_includes, depends def _get_dependencies_flags( - self, deps: T.Sequence[T.Union['Dependency', build.BuildTarget, CustomTarget, CustomTargetIndex]], + self, deps: Sequence[T.Union['Dependency', build.BuildTarget, CustomTarget, CustomTargetIndex]], state: 'ModuleState', - depends: T.Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]], + depends: Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]], include_rpath: bool = False, use_gir_args: bool = False, ) -> T.Tuple[OrderedSet[str], T.List[str], T.List[str], OrderedSet[str], @@ -848,7 +849,7 @@ def _scan_langs(state: 'ModuleState', langs: T.Iterable[str]) -> T.List[str]: return ret @staticmethod - def _scan_gir_targets(state: 'ModuleState', girtargets: T.Sequence[build.BuildTarget]) -> T.List[T.Union[str, Executable]]: + def _scan_gir_targets(state: 'ModuleState', girtargets: Sequence[build.BuildTarget]) -> T.List[T.Union[str, Executable]]: ret: T.List[T.Union[str, Executable]] = [] for girtarget in girtargets: @@ -882,7 +883,7 @@ def _scan_gir_targets(state: 'ModuleState', girtargets: T.Sequence[build.BuildTa return ret @staticmethod - def _get_girtargets_langs_compilers(girtargets: T.Sequence[build.BuildTarget]) -> T.List[T.Tuple[str, 'Compiler']]: + def _get_girtargets_langs_compilers(girtargets: Sequence[build.BuildTarget]) -> T.List[T.Tuple[str, 'Compiler']]: ret: T.List[T.Tuple[str, 'Compiler']] = [] for girtarget in girtargets: for lang, compiler in girtarget.compilers.items(): @@ -894,7 +895,7 @@ def _get_girtargets_langs_compilers(girtargets: T.Sequence[build.BuildTarget]) - return ret @staticmethod - def _get_gir_targets_deps(girtargets: T.Sequence[build.BuildTarget] + def _get_gir_targets_deps(girtargets: Sequence[build.BuildTarget] ) -> T.List[T.Union[build.BuildTarget, CustomTarget, CustomTargetIndex, Dependency]]: ret: T.List[T.Union[build.BuildTarget, CustomTarget, CustomTargetIndex, Dependency]] = [] for girtarget in girtargets: @@ -903,7 +904,7 @@ def _get_gir_targets_deps(girtargets: T.Sequence[build.BuildTarget] return ret @staticmethod - def _get_gir_targets_inc_dirs(girtargets: T.Sequence[build.BuildTarget]) -> OrderedSet[build.IncludeDirs]: + def _get_gir_targets_inc_dirs(girtargets: Sequence[build.BuildTarget]) -> OrderedSet[build.IncludeDirs]: ret: OrderedSet = OrderedSet() for girtarget in girtargets: ret.update(girtarget.get_include_dirs()) @@ -940,8 +941,8 @@ def _get_langs_compilers_flags(state: 'ModuleState', langs_compilers: T.List[T.T @staticmethod def _make_gir_filelist(state: 'ModuleState', srcdir: str, ns: str, - nsversion: str, girtargets: T.Sequence[build.BuildTarget], - libsources: T.Sequence[T.Union[ + nsversion: str, girtargets: Sequence[build.BuildTarget], + libsources: Sequence[T.Union[ str, mesonlib.File, GeneratedList, CustomTarget, CustomTargetIndex]] ) -> str: @@ -971,10 +972,10 @@ def _make_gir_target( self, state: 'ModuleState', girfile: str, - scan_command: T.Sequence[T.Union['FileOrString', Executable, ExternalProgram, OverrideProgram]], - generated_files: T.Sequence[T.Union[str, mesonlib.File, CustomTarget, CustomTargetIndex, GeneratedList]], - depends: T.Sequence[T.Union['FileOrString', build.BuildTarget, 'build.GeneratedTypes', build.StructuredSources]], - env_flags: T.Sequence[str], + scan_command: Sequence[T.Union['FileOrString', Executable, ExternalProgram, OverrideProgram]], + generated_files: Sequence[T.Union[str, mesonlib.File, CustomTarget, CustomTargetIndex, GeneratedList]], + depends: Sequence[T.Union['FileOrString', build.BuildTarget, 'build.GeneratedTypes', build.StructuredSources]], + env_flags: Sequence[str], kwargs: T.Dict[str, T.Any]) -> GirTarget: install = kwargs['install_gir'] if install is None: @@ -1020,8 +1021,8 @@ def _make_gir_target( @staticmethod def _make_typelib_target(state: 'ModuleState', typelib_output: str, - typelib_cmd: T.Sequence[T.Union[str, Executable, ExternalProgram, CustomTarget]], - generated_files: T.Sequence[T.Union[str, mesonlib.File, CustomTarget, CustomTargetIndex, GeneratedList]], + typelib_cmd: Sequence[T.Union[str, Executable, ExternalProgram, CustomTarget]], + generated_files: Sequence[T.Union[str, mesonlib.File, CustomTarget, CustomTargetIndex, GeneratedList]], kwargs: T.Dict[str, T.Any]) -> TypelibTarget: install = kwargs['install_typelib'] if install is None: @@ -1051,8 +1052,8 @@ def _make_typelib_target(state: 'ModuleState', typelib_output: str, @staticmethod def _gather_typelib_includes_and_update_depends( state: 'ModuleState', - deps: T.Sequence[T.Union[Dependency, build.BuildTarget, CustomTarget, CustomTargetIndex]], - depends: T.Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]] + deps: Sequence[T.Union[Dependency, build.BuildTarget, CustomTarget, CustomTargetIndex]], + depends: Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]] ) -> T.Tuple[T.List[str], T.List[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]]]: # Need to recursively add deps on GirTarget sources from our # dependencies and also find the include directories needed for the @@ -1580,7 +1581,7 @@ def abs_filenames(files: T.Iterable['FileOrString']) -> T.Iterator[str]: def _get_build_args(self, c_args: T.List[str], inc_dirs: T.List[T.Union[str, build.IncludeDirs]], deps: T.List[T.Union[Dependency, build.SharedLibrary, build.StaticLibrary]], state: 'ModuleState', - depends: T.Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes']]) -> T.Tuple[ + depends: Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes']]) -> T.Tuple[ T.List[str], T.List[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]]]: args: T.List[str] = [] cflags = c_args.copy() @@ -1884,7 +1885,7 @@ def mkenums(self, state: 'ModuleState', args: T.Tuple[str], kwargs: 'MkEnums') - h_sources.extend(kwargs['sources']) h_target = self._make_mkenum_impl( state, h_sources, h_output, h_cmd, install=kwargs['install_header'], - install_dir=kwargs['install_dir']) + install_dir=[kwargs['install_dir']] if kwargs['install_dir'] else None) targets.append(h_target) if c_template is not None: @@ -1907,7 +1908,7 @@ def mkenums(self, state: 'ModuleState', args: T.Tuple[str], kwargs: 'MkEnums') - target = self._make_mkenum_impl( state, kwargs['sources'], basename, generic_cmd, install=kwargs['install_header'], - install_dir=kwargs['install_dir']) + install_dir=[kwargs['install_dir']] if kwargs['install_dir'] else None) return ModuleReturnValue(target, [target]) else: return ModuleReturnValue(targets, targets) @@ -2034,20 +2035,20 @@ def mkenums_simple(self, state: 'ModuleState', args: T.Tuple[str], kwargs: 'MkEn h_file = self._make_mkenum_impl( state, kwargs['sources'], hdr_filename, h_cmd, install=kwargs['install_header'], - install_dir=kwargs['install_dir']) + install_dir=[kwargs['install_dir']] if kwargs['install_dir'] else None) return ModuleReturnValue([c_file, h_file], [c_file, h_file]) def _make_mkenum_impl( self, state: 'ModuleState', - sources: T.Sequence[T.Union[str, mesonlib.File, CustomTarget, CustomTargetIndex, GeneratedList]], + sources: Sequence[T.Union[str, mesonlib.File, CustomTarget, CustomTargetIndex, GeneratedList]], output: str, cmd: T.List[str], *, install: bool = False, - install_dir: T.Optional[T.Sequence[T.Union[str, bool]]] = None, - depends: T.Optional[T.Sequence[T.Union[CustomTarget, CustomTargetIndex, BuildTarget]]] = None + install_dir: T.Optional[Sequence[T.Union[str, bool]]] = None, + depends: T.Optional[Sequence[T.Union[CustomTarget, CustomTargetIndex, BuildTarget]]] = None ) -> build.CustomTarget: real_cmd: T.List[T.Union[str, 'ToolType']] = [self._find_tool(state, 'glib-mkenums')] real_cmd.extend(cmd)