gnome: Quote arguments passed to gtkdoc-scangobj

It is possible for compiler flags to include special characters, such as
double quotes which are needed to define macros with -D options. Since
gtkdoc-scangobj uses shlex.split to split arguments passed to --cc,
--ld, --cflags, --ldflags into lists, we can safely use shlex.quote to
properly quote arguments for these options.
pull/4354/head
Ting-Wei Lan 6 years ago committed by Jussi Pakkanen
parent fd86b0c619
commit bb9f60624b
  1. 9
      mesonbuild/modules/gnome.py

@ -17,6 +17,7 @@ functionality such as gobject-introspection, gresources and gtk-doc'''
import os
import copy
import shlex
import subprocess
from .. import build
@ -1034,12 +1035,12 @@ This will become a hard error in the future.''')
ldflags.update(compiler_flags[1])
ldflags.update(compiler_flags[2])
if compiler:
args += ['--cc=%s' % ' '.join(compiler.get_exelist())]
args += ['--ld=%s' % ' '.join(compiler.get_linker_exelist())]
args += ['--cc=%s' % ' '.join([shlex.quote(x) for x in compiler.get_exelist()])]
args += ['--ld=%s' % ' '.join([shlex.quote(x) for x in compiler.get_linker_exelist()])]
if cflags:
args += ['--cflags=%s' % ' '.join(cflags)]
args += ['--cflags=%s' % ' '.join([shlex.quote(x) for x in cflags])]
if ldflags:
args += ['--ldflags=%s' % ' '.join(ldflags)]
args += ['--ldflags=%s' % ' '.join([shlex.quote(x) for x in ldflags])]
return args

Loading…
Cancel
Save