Merge pull request #2350 from tintou/master

Add 'install' keyword to the gettext macro
pull/2367/head
Jussi Pakkanen 7 years ago committed by GitHub
commit 2ab4b397a8
  1. 2
      docs/markdown/i18n-module.md
  2. 27
      mesonbuild/modules/i18n.py

@ -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) [source](https://github.com/mesonbuild/meson/blob/master/mesonbuild/modules/i18n.py)
for for their value 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: This function also defines targets for maintainers to use:
**Note**: These output to the source directory **Note**: These output to the source directory

@ -81,7 +81,7 @@ class I18nModule(ExtensionModule):
ct = build.CustomTarget(kwargs['output'] + '_merge', state.subdir, kwargs) ct = build.CustomTarget(kwargs['output'] + '_merge', state.subdir, kwargs)
return ModuleReturnValue(ct, [ct]) 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): def gettext(self, state, args, kwargs):
if len(args) != 1: if len(args) != 1:
raise coredata.MesonException('Gettext requires one positional argument (package name).') raise coredata.MesonException('Gettext requires one positional argument (package name).')
@ -126,16 +126,21 @@ class I18nModule(ExtensionModule):
updatepoargs.append(extra_args) updatepoargs.append(extra_args)
updatepotarget = build.RunTarget(packagename + '-update-po', updatepoargs[0], updatepoargs[1:], [], state.subdir) updatepotarget = build.RunTarget(packagename + '-update-po', updatepoargs[0], updatepoargs[1:], [], state.subdir)
script = state.environment.get_build_command() targets = [pottarget, gmotarget, updatepotarget]
args = ['--internal', 'gettext', 'install',
'--subdir=' + state.subdir, install = kwargs.get('install', True)
'--localedir=' + state.environment.coredata.get_builtin_option('localedir'), if install:
pkg_arg] script = state.environment.get_build_command()
if lang_arg: args = ['--internal', 'gettext', 'install',
args.append(lang_arg) '--subdir=' + state.subdir,
iscript = build.RunScript(script, args) '--localedir=' + state.environment.coredata.get_builtin_option('localedir'),
pkg_arg]
return ModuleReturnValue(None, [pottarget, gmotarget, iscript, updatepotarget]) if lang_arg:
args.append(lang_arg)
iscript = build.RunScript(script, args)
targets.append(iscript)
return ModuleReturnValue(None, targets)
def initialize(): def initialize():
return I18nModule() return I18nModule()

Loading…
Cancel
Save