diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-09-29 20:57:26 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2021-09-30 16:09:14 -0700 |
commit | 61f2866a9fa1824298bbafca8ddaaba4b169852d (patch) | |
tree | 64a388aef2e39db2655a3c39adf18f5cff9701c4 /mesonbuild | |
parent | 3bb962975e7cf0ed673b8ffe39665239d41278ee (diff) | |
download | meson-61f2866a9fa1824298bbafca8ddaaba4b169852d.zip meson-61f2866a9fa1824298bbafca8ddaaba4b169852d.tar.gz meson-61f2866a9fa1824298bbafca8ddaaba4b169852d.tar.bz2 |
modules/i18n: use typed_pos_args
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/modules/i18n.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py index 3d504ac..0da1988 100644 --- a/mesonbuild/modules/i18n.py +++ b/mesonbuild/modules/i18n.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from mesonbuild.interpreterbase.decorators import noPosargs, typed_pos_args from os import path import shutil import typing as T @@ -28,6 +29,7 @@ from ..scripts.gettext import read_linguas if T.TYPE_CHECKING: from . import ModuleState from ..interpreter import Interpreter + from ..interpreterbase import TYPE_var PRESET_ARGS = { 'glib': [ @@ -85,7 +87,8 @@ class I18nModule(ExtensionModule): @FeatureNew('i18n.merge_file', '0.37.0') @FeatureNewKwargs('i18n.merge_file', '0.51.0', ['args']) @permittedKwargs(build.CustomTarget.known_kwargs | {'data_dirs', 'po_dir', 'type', 'args'}) - def merge_file(self, state: 'ModuleState', args, kwargs) -> ModuleReturnValue: + @noPosargs + def merge_file(self, state: 'ModuleState', args: T.List['TYPE_var'], kwargs) -> ModuleReturnValue: if not shutil.which('xgettext'): self.nogettext_warning() return @@ -139,9 +142,8 @@ class I18nModule(ExtensionModule): @FeatureNewKwargs('i18n.gettext', '0.37.0', ['preset']) @FeatureNewKwargs('i18n.gettext', '0.50.0', ['install_dir']) @permittedKwargs({'po_dir', 'data_dirs', 'type', 'languages', 'args', 'preset', 'install', 'install_dir'}) - def gettext(self, state: 'ModuleState', args, kwargs) -> ModuleReturnValue: - if len(args) != 1: - raise coredata.MesonException('Gettext requires one positional argument (package name).') + @typed_pos_args('i81n.gettex', str) + def gettext(self, state: 'ModuleState', args: T.Tuple[str], kwargs) -> ModuleReturnValue: if not shutil.which('xgettext'): self.nogettext_warning() return |