diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-10-23 04:39:15 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-23 04:39:15 -0700 |
commit | b50f3e6976989e13d0d413b4af1547f5862cdfa9 (patch) | |
tree | c8919faf8bb0e7953eaec2920abb22b8f5ffd8e5 /mesonbuild/modules/gnome.py | |
parent | 5f20b38d444542f3538c0732cfa54afacea9ec89 (diff) | |
parent | f1022f9b7bbd6e6eefff9b4f4ca7b5cbc97b47bf (diff) | |
download | meson-b50f3e6976989e13d0d413b4af1547f5862cdfa9.zip meson-b50f3e6976989e13d0d413b4af1547f5862cdfa9.tar.gz meson-b50f3e6976989e13d0d413b4af1547f5862cdfa9.tar.bz2 |
Merge pull request #934 from mesonbuild/wip/tingping/gnome-yelp
gnome: Add yelp() function
Diffstat (limited to 'mesonbuild/modules/gnome.py')
-rw-r--r-- | mesonbuild/modules/gnome.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index bb6abd4..0a1d916 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -17,6 +17,7 @@ functionality such as gobject-introspection and gresources.''' from .. import build import os +import sys import subprocess from ..mesonlib import MesonException from .. import dependencies @@ -461,6 +462,65 @@ class GnomeModule: target_g = build.CustomTarget(targetname, state.subdir, kwargs) return target_g + def yelp(self, state, args, kwargs): + if len(args) < 1: + raise MesonException('Yelp requires a project id') + + project_id = args[0] + sources = mesonlib.stringlistify(kwargs.pop('sources', [])) + if not sources: + if len(args) > 1: + sources = mesonlib.stringlistify(args[1:]) + if not sources: + raise MesonException('Yelp requires a list of sources') + source_str = '@@'.join(sources) + + langs = mesonlib.stringlistify(kwargs.pop('languages', [])) + media = mesonlib.stringlistify(kwargs.pop('media', [])) + symlinks = kwargs.pop('symlink_media', False) + + if not isinstance(symlinks, bool): + raise MesonException('symlink_media must be a boolean') + + if kwargs: + raise MesonException('Unknown arguments passed: {}'.format(', '.join(kwargs.keys()))) + + install_cmd = [ + sys.executable, + state.environment.get_build_command(), + '--internal', + 'yelphelper', + 'install', + '--subdir=' + state.subdir, + '--id=' + project_id, + '--installdir=' + os.path.join(state.environment.get_datadir(), 'help'), + '--sources=' + source_str, + ] + if symlinks: + install_cmd.append('--symlinks=true') + if media: + install_cmd.append('--media=' + '@@'.join(media)) + if langs: + install_cmd.append('--langs=' + '@@'.join(langs)) + inscript = build.InstallScript(install_cmd) + + potargs = [state.environment.get_build_command(), '--internal', 'yelphelper', 'pot', + '--subdir=' + state.subdir, + '--id=' + project_id, + '--sources=' + source_str] + pottarget = build.RunTarget('help-' + project_id + '-pot', sys.executable, + potargs, [], state.subdir) + + poargs = [state.environment.get_build_command(), '--internal', 'yelphelper', 'update-po', + '--subdir=' + state.subdir, + '--id=' + project_id, + '--sources=' + source_str, + '--langs=' + '@@'.join(langs)] + potarget = build.RunTarget('help-' + project_id + '-update-po', sys.executable, + poargs, [], state.subdir) + + return [inscript, pottarget, potarget] + def gtkdoc(self, state, args, kwargs): if len(args) != 1: raise MesonException('Gtkdoc must have one positional argument.') |