diff options
| -rw-r--r-- | docs/yaml/functions/configure_file.yaml | 3 | ||||
| -rw-r--r-- | docs/yaml/functions/custom_target.yaml | 3 | ||||
| -rw-r--r-- | docs/yaml/functions/install_data.yaml | 3 | ||||
| -rw-r--r-- | docs/yaml/functions/install_emptydir.yaml | 3 | ||||
| -rw-r--r-- | docs/yaml/functions/install_headers.yaml | 3 | ||||
| -rw-r--r-- | docs/yaml/functions/install_man.yaml | 3 | ||||
| -rw-r--r-- | docs/yaml/functions/install_subdir.yaml | 3 | ||||
| -rw-r--r-- | mesonbuild/interpreter/type_checking.py | 13 |
8 files changed, 32 insertions, 2 deletions
diff --git a/docs/yaml/functions/configure_file.yaml b/docs/yaml/functions/configure_file.yaml index 8f4d9e09b..df37ff581 100644 --- a/docs/yaml/functions/configure_file.yaml +++ b/docs/yaml/functions/configure_file.yaml @@ -20,6 +20,9 @@ description: | this function will copy the file provided in `input:` to a file in the build directory with the name `output:` in the current directory. +warnings: + - the `install_mode` kwarg ignored integer values between 0.62 -- 1.1.0. + kwargs: capture: type: bool diff --git a/docs/yaml/functions/custom_target.yaml b/docs/yaml/functions/custom_target.yaml index 7d052820c..caccd4883 100644 --- a/docs/yaml/functions/custom_target.yaml +++ b/docs/yaml/functions/custom_target.yaml @@ -52,6 +52,9 @@ notes: is not portable, notably to Windows. Instead, consider using a `native: true` [[executable]], or a python script. +warnings: + - the `install_mode` kwarg ignored integer values between 0.60.0 -- 1.1.0. + optargs: name: type: str diff --git a/docs/yaml/functions/install_data.yaml b/docs/yaml/functions/install_data.yaml index 191c6129d..b0834791e 100644 --- a/docs/yaml/functions/install_data.yaml +++ b/docs/yaml/functions/install_data.yaml @@ -10,6 +10,9 @@ varargs: type: file | str description: Files to install. +warnings: + - the `install_mode` kwarg ignored integer values between 0.59.0 -- 1.1.0. + kwargs: install_dir: type: str diff --git a/docs/yaml/functions/install_emptydir.yaml b/docs/yaml/functions/install_emptydir.yaml index e598b5e9a..df84f60b5 100644 --- a/docs/yaml/functions/install_emptydir.yaml +++ b/docs/yaml/functions/install_emptydir.yaml @@ -6,6 +6,9 @@ description: | argument. If the directory exists and is not empty, the contents are left in place. +warnings: + - the `install_mode` kwarg ignored integer values before 1.1.0. + varargs: name: dirpath type: str diff --git a/docs/yaml/functions/install_headers.yaml b/docs/yaml/functions/install_headers.yaml index 65489d24f..958ab156e 100644 --- a/docs/yaml/functions/install_headers.yaml +++ b/docs/yaml/functions/install_headers.yaml @@ -41,6 +41,9 @@ varargs: type: file | str description: Header files to install. +warnings: + - the `install_mode` kwarg ignored integer values between 0.59.0 -- 1.1.0. + kwargs: install_dir: type: str diff --git a/docs/yaml/functions/install_man.yaml b/docs/yaml/functions/install_man.yaml index b695dc13d..8d9ba6037 100644 --- a/docs/yaml/functions/install_man.yaml +++ b/docs/yaml/functions/install_man.yaml @@ -15,6 +15,9 @@ varargs: type: file | str description: Man pages to install. +warnings: + - the `install_mode` kwarg ignored integer values between 0.59.0 -- 1.1.0. + kwargs: install_mode: type: list[str | int] diff --git a/docs/yaml/functions/install_subdir.yaml b/docs/yaml/functions/install_subdir.yaml index 90baed23b..1907cec40 100644 --- a/docs/yaml/functions/install_subdir.yaml +++ b/docs/yaml/functions/install_subdir.yaml @@ -56,6 +56,9 @@ example: | new_directory/ ``` +warnings: + - the `install_mode` kwarg ignored integer values between 0.59.0 -- 1.1.0. + posargs: subdir_name: type: str diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py index beae0018b..2d2b916eb 100644 --- a/mesonbuild/interpreter/type_checking.py +++ b/mesonbuild/interpreter/type_checking.py @@ -97,8 +97,17 @@ def _install_mode_validator(mode: T.List[T.Union[str, bool, int]]) -> T.Optional def _install_mode_convertor(mode: T.Optional[T.List[T.Union[str, bool, int]]]) -> FileMode: """Convert the DSL form of the `install_mode` keyword argument to `FileMode`""" - # this has already been validated by the validator - return FileMode(*(m if isinstance(m, str) else None for m in mode)) + if not mode: + return FileMode() + + # This has already been validated by the validator. False denotes "use + # default". mypy is totally incapable of understanding it, because + # generators clobber types via homogeneous return. But also we *must* + # convert the first element different from the rest + m1 = mode[0] if isinstance(mode[0], str) else None + rest = (m if isinstance(m, (str, int)) else None for m in mode[1:]) + + return FileMode(m1, *rest) def _lower_strlist(input: T.List[str]) -> T.List[str]: |
