[gtk-doc/wip/lantw/revert-scangobj-shlex-workaround] scangobj: revert the recent shlex changes



commit 596ce1dde9064ab2fc6e3d1a5624edb66df74434
Author: Ting-Wei Lan <lantw src gnome org>
Date:   Sat Oct 27 10:55:23 2018 +0800

    scangobj: revert the recent shlex changes
    
    This reverts the following commits:
    
    e37b083ebe1516152808fe76968512b789cb2ec0  Add a comment explaining previous change
    bdd4b1b3d4287fa4bfa997c93342213d8220ce7b  scangobj: keep quotes when splitting with shlex
    
    Python shlex.split itself isn't broken. It can properly handles
    arguments with quote characters as long as it is quoted correctly with
    functions such as shlex.quote. However, gnome.gtkdoc function in
    meson 0.48 doesn't do it correctly. It joins all arguments with spaces
    without quoting these arguments first, causing quotes in arguments
    themselves to be removed when it is processed by shlex.split.
    
    The meson bug described above is fixed on the master branch before the
    shlex workaround committed to gtk-doc, so the workaround was, in fact,
    never really needed. Furthermore, the workaround causes gtkdoc-scangobj
    to interpret the command line differently with the shell, making it
    harder to use correctly and break builds when arguments are properly
    quoted with the rules of shell.
    
    This fixes gtk-doc builds for at-spi2-core and WebKitGTK+.
    
    https://github.com/mesonbuild/meson/pull/4348
    https://gitlab.gnome.org/GNOME/gtk-doc/merge_requests/7

 gtkdoc/scangobj.py             | 14 ++------------
 tests/gobject/docs/meson.build | 17 -----------------
 2 files changed, 2 insertions(+), 29 deletions(-)
---
diff --git a/gtkdoc/scangobj.py b/gtkdoc/scangobj.py
index 0de791b..73c23b0 100644
--- a/gtkdoc/scangobj.py
+++ b/gtkdoc/scangobj.py
@@ -1204,15 +1204,6 @@ def execute_command(options, description, command):
     return 0
 
 
-def split_with_quote(string):
-    # This is required to handle CFLAGS such as -DG_LOG_DOMAIN="tester"
-    lex = shlex.shlex(string)
-    lex.quotes = '"'
-    lex.whitespace_split = True
-    lex.commenters = ''
-    return list(lex)
-
-
 def run(options):
     logging.info('options: %s', str(options.__dict__))
 
@@ -1289,15 +1280,14 @@ def run(options):
     logging.debug('Intermediate scanner files: %s, %s, %s', c_file, o_file, x_file)
 
     res = execute_command(options, 'Compiling',
-                          shlex.split(options.cc) +
-                          split_with_quote(options.cflags) +
+                          shlex.split(options.cc) + shlex.split(options.cflags) +
                           ["-c", "-o", o_file, c_file])
     if res:
         return res
 
     res = execute_command(options, 'Linking',
                           shlex.split(options.ld) + [o_file] +
-                          split_with_quote(options.ldflags) + ['-o', x_file])
+                          shlex.split(options.ldflags) + ['-o', x_file])
     if res:
         return res
 
diff --git a/tests/gobject/docs/meson.build b/tests/gobject/docs/meson.build
index b7e4495..e1e6acc 100644
--- a/tests/gobject/docs/meson.build
+++ b/tests/gobject/docs/meson.build
@@ -54,23 +54,6 @@ test(
   ],
 )
 
-test(
-  'test-gobject-scangobj-quoted-cflags',
-  python_prg,
-  workdir: gobject_test_output_dir,
-  is_parallel: false,
-  args: [
-    gtkdoc_scangobj_runner_script,
-    '--binary-dir=@0@'.format(builddir),
-    '--pkg-config=@0@'.format(pkgconfig_prg_path),
-    '--extra-pkg=@0@'.format('glib-2.0'),
-    '--extra-pkg=@0@'.format('gobject-2.0'),
-    '--extra-cflags=@0@'.format('-DG_LOG_DOMAIN="tester"'),
-    '--extra-lib=@0@'.format(gobject_test_lib.full_path()),
-    '--module=@0@'.format('tester'),
-  ],
-)
-
 test(
   'test-gobject-mkdb',
   python_prg,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]