PKGBUILDs/extra/meson/0001-i18n-merge_file-deprecate-positional-arguments.patch

53 lines
2.2 KiB
Diff
Raw Normal View History

2021-10-31 22:31:01 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xavier Claessens <xavier.claessens@collabora.com>
Date: Mon, 25 Oct 2021 09:19:25 -0400
Subject: [PATCH] i18n: merge_file() deprecate positional arguments
They always have been ignored but it became an hard error with no
deprecation period in 0.60.0. Since it breaks some GNOME projects,
deprecate for now and keep it removed for 0.61.0.
Fixes: #9441
---
mesonbuild/modules/i18n.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py
index 7c6f0f4dab62..975fbf63b0b5 100644
--- a/mesonbuild/modules/i18n.py
+++ b/mesonbuild/modules/i18n.py
@@ -22,7 +22,7 @@ from .. import mesonlib
from .. import mlog
from ..interpreter.type_checking import CT_BUILD_BY_DEFAULT, CT_INPUT_KW, CT_INSTALL_DIR_KW, CT_INSTALL_TAG_KW, CT_OUTPUT_KW, INSTALL_KW, NoneType, in_set_validator
from ..interpreterbase import FeatureNew
-from ..interpreterbase.decorators import ContainerTypeInfo, KwargInfo, noPosargs, typed_kwargs, typed_pos_args
+from ..interpreterbase.decorators import ContainerTypeInfo, KwargInfo, typed_kwargs, typed_pos_args
from ..scripts.gettext import read_linguas
if T.TYPE_CHECKING:
@@ -128,21 +128,23 @@ class I18nModule(ExtensionModule):
return [path.join(src_dir, d) for d in dirs]
@FeatureNew('i18n.merge_file', '0.37.0')
- @noPosargs
@typed_kwargs(
'i18n.merge_file',
CT_BUILD_BY_DEFAULT,
CT_INPUT_KW,
CT_INSTALL_DIR_KW,
CT_INSTALL_TAG_KW,
CT_OUTPUT_KW,
INSTALL_KW,
_ARGS.evolve(since='0.51.0'),
_DATA_DIRS,
KwargInfo('po_dir', str, required=True),
KwargInfo('type', str, default='xml', validator=in_set_validator({'xml', 'desktop'})),
)
def merge_file(self, state: 'ModuleState', args: T.List['TYPE_var'], kwargs: 'MergeFile') -> ModuleReturnValue:
+ if args:
+ mlog.deprecation('i18n.merge_file does not take any positional arguments. '
+ 'This will become a hard error in the next Meson release.')
if not shutil.which('xgettext'):
self.nogettext_warning()
return ModuleReturnValue(None, [])