aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules/gnome.py
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2016-08-25 01:42:40 -0400
committerElliott Sales de Andrade <quantum.analyst@gmail.com>2016-09-28 18:20:17 -0400
commitab004ab1895b562af6dd16d396327b2ae2b52dd0 (patch)
tree14bc24b9f192e2b196a499e83b02150c30e34939 /mesonbuild/modules/gnome.py
parent0a4957627a1e7bc88a74e9398fdf3b6e17cd7b05 (diff)
downloadmeson-ab004ab1895b562af6dd16d396327b2ae2b52dd0.zip
meson-ab004ab1895b562af6dd16d396327b2ae2b52dd0.tar.gz
meson-ab004ab1895b562af6dd16d396327b2ae2b52dd0.tar.bz2
Add support for glib-mkenums to gnome module.
Diffstat (limited to 'mesonbuild/modules/gnome.py')
-rw-r--r--mesonbuild/modules/gnome.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 11abf88..6a190b7 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -473,6 +473,53 @@ class GnomeModule:
}
return build.CustomTarget(namebase + '-gdbus', state.subdir, custom_kwargs)
+ def mkenums(self, state, args, kwargs):
+ if len(args) != 1:
+ raise MesonException('Mkenums requires one positional argument.')
+ output = args[0]
+
+ if 'sources' not in kwargs:
+ raise MesonException('Missing keyword argument "sources".')
+ sources = kwargs.pop('sources')
+ if isinstance(sources, str):
+ sources = [sources]
+ elif not isinstance(sources, list):
+ raise MesonException(
+ 'Sources keyword argument must be a string or array.')
+
+ cmd = ['glib-mkenums']
+ known_kwargs = ['comments', 'eprod', 'fhead', 'fprod', 'ftail',
+ 'identifier-prefix', 'symbol-prefix', 'template',
+ 'vhead', 'vprod', 'vtail']
+ known_custom_target_kwargs = ['install', 'install_dir', 'build_always',
+ 'depends', 'depend_files']
+ add_template = False
+ for arg, value in kwargs.items():
+ if arg == 'template':
+ add_template = True
+ sources = [value] + sources
+ elif arg in known_kwargs:
+ cmd += ['--' + arg, value]
+ elif arg not in known_custom_target_kwargs:
+ raise MesonException(
+ 'Mkenums does not take a %s keyword argument.' % (arg, ))
+ if add_template:
+ cmd += ['--template', '@INPUT@']
+ else:
+ cmd += ['@INPUT@']
+
+ custom_kwargs = {
+ 'input': sources,
+ 'output': output,
+ 'capture': True,
+ 'command': cmd
+ }
+ for arg in known_custom_target_kwargs:
+ if arg in kwargs:
+ custom_kwargs[arg] = kwargs[arg]
+ return build.CustomTarget(output, state.subdir, custom_kwargs)
+
+
def initialize():
return GnomeModule()