type_checking: add a type checking helper for strings in include_directories

pull/11024/head
Dylan Baker 2 years ago committed by Eli Schwartz
parent c2e392d78d
commit ff3083c956
  1. 9
      mesonbuild/interpreter/type_checking.py

@ -13,6 +13,7 @@ from ..build import (CustomTarget, BuildTarget,
BothLibraries, SharedLibrary, StaticLibrary, Jar, Executable)
from ..coredata import UserFeatureOption
from ..dependencies import Dependency, InternalDependency
from ..interpreterbase import FeatureNew
from ..interpreterbase.decorators import KwargInfo, ContainerTypeInfo
from ..mesonlib import (
File, FileMode, MachineChoice, listify, has_path_sep, OptionKey,
@ -26,6 +27,7 @@ if T.TYPE_CHECKING:
from typing_extensions import Literal
from ..interpreterbase import TYPE_var
from ..interpreterbase.decorators import FeatureCheckBase
def in_set_validator(choices: T.Set[str]) -> T.Callable[[str], T.Optional[str]]:
"""Check that the choice given was one of the given set."""
@ -373,6 +375,13 @@ INCLUDE_DIRECTORIES: KwargInfo[T.List[T.Union[str, IncludeDirs]]] = KwargInfo(
default=[],
)
def include_dir_string_new(val: T.List[T.Union[str, IncludeDirs]]) -> T.Iterable[FeatureCheckBase]:
strs = [v for v in val if isinstance(v, str)]
if strs:
str_msg = ", ".join(f"'{s}'" for s in strs)
yield FeatureNew('include_directories kwarg of type string', '1.0.0',
f'Use include_directories({str_msg}) instead')
# for cases like default_options and override_options
DEFAULT_OPTIONS: KwargInfo[T.List[str]] = KwargInfo(
'default_options',

Loading…
Cancel
Save