From 6a2926870cc0f0a8bb970dc5f16aba85789c088c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Wed, 20 Sep 2017 20:17:59 +0200 Subject: Add 'install' keyword to the gettext macro --- mesonbuild/modules/i18n.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py index 2af09de..2281cc1 100644 --- a/mesonbuild/modules/i18n.py +++ b/mesonbuild/modules/i18n.py @@ -81,7 +81,7 @@ class I18nModule(ExtensionModule): ct = build.CustomTarget(kwargs['output'] + '_merge', state.subdir, kwargs) return ModuleReturnValue(ct, [ct]) - @permittedKwargs({'po_dir', 'data_dirs', 'type', 'languages', 'args', 'preset'}) + @permittedKwargs({'po_dir', 'data_dirs', 'type', 'languages', 'args', 'preset', 'install'}) def gettext(self, state, args, kwargs): if len(args) != 1: raise coredata.MesonException('Gettext requires one positional argument (package name).') @@ -126,16 +126,21 @@ class I18nModule(ExtensionModule): updatepoargs.append(extra_args) updatepotarget = build.RunTarget(packagename + '-update-po', updatepoargs[0], updatepoargs[1:], [], state.subdir) - script = state.environment.get_build_command() - args = ['--internal', 'gettext', 'install', - '--subdir=' + state.subdir, - '--localedir=' + state.environment.coredata.get_builtin_option('localedir'), - pkg_arg] - if lang_arg: - args.append(lang_arg) - iscript = build.RunScript(script, args) - - return ModuleReturnValue(None, [pottarget, gmotarget, iscript, updatepotarget]) + targets = [pottarget, gmotarget, updatepotarget] + + install = kwargs.get('install') if ('install' in kwargs) else True + if install: + script = state.environment.get_build_command() + args = ['--internal', 'gettext', 'install', + '--subdir=' + state.subdir, + '--localedir=' + state.environment.coredata.get_builtin_option('localedir'), + pkg_arg] + if lang_arg: + args.append(lang_arg) + iscript = build.RunScript(script, args) + targets.append(iscript) + + return ModuleReturnValue(None, targets) def initialize(): return I18nModule() -- cgit v1.1 From 3e6c3ea10ca09fcecd403a79cb6fb02c6bd45393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Wed, 20 Sep 2017 20:34:20 +0200 Subject: Change ternary to another argument --- mesonbuild/modules/i18n.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py index 2281cc1..5df8524 100644 --- a/mesonbuild/modules/i18n.py +++ b/mesonbuild/modules/i18n.py @@ -128,7 +128,7 @@ class I18nModule(ExtensionModule): targets = [pottarget, gmotarget, updatepotarget] - install = kwargs.get('install') if ('install' in kwargs) else True + install = kwargs.get('install', True) if install: script = state.environment.get_build_command() args = ['--internal', 'gettext', 'install', -- cgit v1.1 From 34c6cccde2dff2b73e3266760db0f0ac5d48664b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Fri, 22 Sep 2017 01:08:10 +0200 Subject: Update i18n markdown page to add the new install parameter --- docs/markdown/i18n-module.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/markdown/i18n-module.md b/docs/markdown/i18n-module.md index 5e6004a..1144e29 100644 --- a/docs/markdown/i18n-module.md +++ b/docs/markdown/i18n-module.md @@ -32,6 +32,8 @@ argument which is the name of the gettext module. [source](https://github.com/mesonbuild/meson/blob/master/mesonbuild/modules/i18n.py) for for their value +* `install`: (*Added 0.43.0*) if false, do not install the built translations. + This function also defines targets for maintainers to use: **Note**: These output to the source directory -- cgit v1.1