aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2016-10-23 12:56:29 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2016-11-02 13:54:57 -0700
commit314eb5110e14a71939f1535f4271461d9c439b50 (patch)
treea0d24678f22a8c69b40affe13232f399c23d2125 /mesonbuild/modules
parent3650669874050c7990a751e799542dbf1b1805bf (diff)
downloadmeson-314eb5110e14a71939f1535f4271461d9c439b50.zip
meson-314eb5110e14a71939f1535f4271461d9c439b50.tar.gz
meson-314eb5110e14a71939f1535f4271461d9c439b50.tar.bz2
gettext: Use argparse to handle arguments
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/i18n.py41
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():