diff options
Diffstat (limited to 'mesonbuild/modules/i18n.py')
-rw-r--r-- | mesonbuild/modules/i18n.py | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py index 28e04cb..1ddb2fc 100644 --- a/mesonbuild/modules/i18n.py +++ b/mesonbuild/modules/i18n.py @@ -26,29 +26,36 @@ class I18nModule: raise coredata.MesonException('List of languages empty.') datadirs = mesonlib.stringlistify(kwargs.get('data_dirs', [])) extra_args = mesonlib.stringlistify(kwargs.get('args', [])) - potargs = [state.environment.get_build_command(), '--internal', 'gettext', 'pot', packagename] + + pkg_arg = '--pkgname=' + packagename + lang_arg = '--langs=' + '@@'.join(languages) + datadirs = '--datadirs=' + ':'.join(datadirs) if datadirs else None + extra_args = '--extra-args=' + '@@'.join(extra_args) if extra_args else None + + potargs = [state.environment.get_build_command(), '--internal', 'gettext', 'pot', pkg_arg] if datadirs: - potargs.append('--datadirs=' + ':'.join(datadirs)) - potargs += extra_args + potargs.append(datadirs) + if extra_args: + potargs.append(extra_args) pottarget = build.RunTarget(packagename + '-pot', sys.executable, potargs, [], state.subdir) - gmoargs = [state.environment.get_build_command(), '--internal', 'gettext', 'gen_gmo'] + languages + + gmoargs = [state.environment.get_build_command(), '--internal', 'gettext', 'gen_gmo', lang_arg] gmotarget = build.RunTarget(packagename + '-gmo', sys.executable, gmoargs, [], state.subdir) - updatepoargs = [state.environment.get_build_command(), '--internal', 'gettext', 'update_po', packagename] - updatepoargs.append('@@'.join(languages)) + + updatepoargs = [state.environment.get_build_command(), '--internal', 'gettext', 'update_po', pkg_arg, lang_arg] if datadirs: - updatepoargs.append('--datadirs=' + ':'.join(datadirs)) - updatepoargs += extra_args + updatepoargs.append(datadirs) + if extra_args: + updatepoargs.append(extra_args) updatepotarget = build.RunTarget(packagename + '-update-po', sys.executable, updatepoargs, [], state.subdir) - installcmd = [sys.executable, - state.environment.get_build_command(), - '--internal', - 'gettext', - 'install', - state.subdir, - packagename, - state.environment.coredata.get_builtin_option('localedir'), - ] + languages + + installcmd = [sys.executable, state.environment.get_build_command(), + '--internal', 'gettext', 'install', + '--subdir=' + state.subdir, + '--localedir=' + state.environment.coredata.get_builtin_option('localedir'), + pkg_arg, lang_arg] iscript = build.InstallScript(installcmd) + return [pottarget, gmotarget, iscript, updatepotarget] def initialize(): |