Can set extra args to gtkdoc scan.

pull/288/head
Jussi Pakkanen 9 years ago
parent 0b63f32fe3
commit bbbe102cc2
  1. 15
      gtkdochelper.py
  2. 25
      modules/gnome.py

@ -27,16 +27,18 @@ parser.add_argument('--headerdir', dest='headerdir')
parser.add_argument('--mainfile', dest='mainfile') parser.add_argument('--mainfile', dest='mainfile')
parser.add_argument('--modulename', dest='modulename') parser.add_argument('--modulename', dest='modulename')
parser.add_argument('--htmlargs', dest='htmlargs', default='') parser.add_argument('--htmlargs', dest='htmlargs', default='')
parser.add_argument('--scanargs', dest='scanargs', default='')
def build_gtkdoc(source_root, build_root, doc_subdir, src_subdir, def build_gtkdoc(source_root, build_root, doc_subdir, src_subdir,
main_file, module, html_args): main_file, module, html_args, scan_args):
abs_src = os.path.join(source_root, src_subdir) abs_src = os.path.join(source_root, src_subdir)
abs_out = os.path.join(build_root, doc_subdir) abs_out = os.path.join(build_root, doc_subdir)
htmldir = os.path.join(abs_out, 'html') htmldir = os.path.join(abs_out, 'html')
subprocess.check_call(['gtkdoc-scan', subprocess.check_call(['gtkdoc-scan',
'--module=' + module, '--module=' + module,
'--source-dir=' + abs_src, '--source-dir=' + abs_src,
'--output-dir=.'], cwd=abs_out) '--output-dir=.'] + scan_args,
cwd=abs_out)
if main_file.endswith('sgml'): if main_file.endswith('sgml'):
modeflag = '--sgml-mode' modeflag = '--sgml-mode'
else: else:
@ -78,17 +80,22 @@ def install_gtkdoc(build_root, doc_subdir, install_prefix, datadir, module):
if __name__ == '__main__': if __name__ == '__main__':
options = parser.parse_args(sys.argv[1:]) options = parser.parse_args(sys.argv[1:])
if len(options.htmlargs) >0: if len(options.htmlargs) > 0:
htmlargs = options.htmlargs.split('@@') htmlargs = options.htmlargs.split('@@')
else: else:
htmlargs = [] htmlargs = []
if len(options.scanargs) > 0:
scanargs = options.scanargs.split('@@')
else:
scanargs = []
build_gtkdoc(options.sourcedir, build_gtkdoc(options.sourcedir,
options.builddir, options.builddir,
options.subdir, options.subdir,
options.headerdir, options.headerdir,
options.mainfile, options.mainfile,
options.modulename, options.modulename,
htmlargs) htmlargs,
scanargs)
if 'MESON_INSTALL_PREFIX' in os.environ: if 'MESON_INSTALL_PREFIX' in os.environ:
if 'DESTDIR' in os.environ: if 'DESTDIR' in os.environ:

@ -233,21 +233,26 @@ class GnomeModule:
'--headerdir=' + header_dir, '--headerdir=' + header_dir,
'--mainfile=' + main_file, '--mainfile=' + main_file,
'--modulename=' + modulename] '--modulename=' + modulename]
args += self.unpack_args('--htmlargs=', 'html_args', kwargs)
args += self.unpack_args('--scanargs=', 'scan_args', kwargs)
res = [build.RunTarget(targetname, command, args, state.subdir)]
if kwargs.get('install', True):
res.append(build.InstallScript([command] + args))
return res
def unpack_args(self, arg, kwarg_name, kwargs):
try: try:
html_args = kwargs['html_args'] new_args = kwargs[kwarg_name]
if not isinstance(html_args, list): if not isinstance(new_args, list):
html_args = [html_args] new_args = [new_args]
for i in html_args: for i in new_args:
if not isinstance(i, str): if not isinstance(i, str):
raise MesonException('html_args values must be strings.') raise MesonException('html_args values must be strings.')
except KeyError: except KeyError:
html_args = [] return[]
if len(html_args) > 0: if len(html_args) > 0:
args.append('--htmlargs=' + '@@'.join(html_args)) return ['--htmlargs=' + '@@'.join(new_args)]
res = [build.RunTarget(targetname, command, args, state.subdir)] return []
if kwargs.get('install', True):
res.append(build.InstallScript([command] + args))
return res
def gdbus_codegen(self, state, args, kwargs): def gdbus_codegen(self, state, args, kwargs):
if len(args) != 2: if len(args) != 2:

Loading…
Cancel
Save