[gtk-doc: 1/5] scanner: avoid passing regex in command line



commit 803f9982c3258fc4dcda7616e910dc2873d92d9e
Author: Xavier Claessens <xavier claessens collabora com>
Date:   Tue Jul 9 08:14:01 2019 -0400

    scanner: avoid passing regex in command line
    
    --ignore-decorator takes a regex such as `DEPRECATED_FOR\(.*\)` but that
    leads to escaping nightmares and doesn't work when using Meson. The
    ninja backend translates every `\` to `/` otherwise it breaks paths on
    Windows, it is a know bug in Meson's ninja backend that cannot (easily)
    be fixed.
    
    Workaround this by allowing `DEPRECATED_FOR()` syntax and internally
    translate that to the proper regex. That's the only use-case I'm aware
    of.

 gtkdoc/scan.py              | 2 +-
 tests/bugs/docs/Makefile.am | 2 +-
 tests/bugs/docs/meson.build | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gtkdoc/scan.py b/gtkdoc/scan.py
index 7da060f..804a7b3 100644
--- a/gtkdoc/scan.py
+++ b/gtkdoc/scan.py
@@ -378,7 +378,7 @@ def ScanHeaderContent(input_lines, decl_list, get_types, options):
     # avoid generating regex with |'' (matching no string)
     ignore_decorators = ''
     if options.ignore_decorators:
-        ignore_decorators = '|' + options.ignore_decorators
+        ignore_decorators = '|' + options.ignore_decorators.replace('()', '\(\w*\)')
 
     # FUNCTION POINTER VARIABLES
     CLINE_MATCHER[4] = re.compile(
diff --git a/tests/bugs/docs/Makefile.am b/tests/bugs/docs/Makefile.am
index 7e3643c..d09c94a 100644
--- a/tests/bugs/docs/Makefile.am
+++ b/tests/bugs/docs/Makefile.am
@@ -19,7 +19,7 @@ SCANGOBJ_OPTIONS=
 
 # Extra options to supply to gtkdoc-scan.
 SCAN_OPTIONS=--deprecated-guards="GTKDOC_TESTER_DISABLE_DEPRECATED" \
-  --ignore-decorators='GLIB_VAR|GTKDOC_GNUC_CONST|BUG_711598_DEPRECATED_FOR\(.+\)' \
+  --ignore-decorators='GLIB_VAR|GTKDOC_GNUC_CONST|BUG_711598_DEPRECATED_FOR()' \
   --rebuild-types
 
 # Extra options to supply to gtkdoc-mkdb.
diff --git a/tests/bugs/docs/meson.build b/tests/bugs/docs/meson.build
index 567fb4f..e39d446 100644
--- a/tests/bugs/docs/meson.build
+++ b/tests/bugs/docs/meson.build
@@ -34,7 +34,7 @@ test(
     '--source-dir=@0@'.format(bugs_test_source_dir),
     '--ignore-headers=config.h',
     '--deprecated-guards=GTKDOC_TESTER_DISABLE_DEPRECATED',
-    '--ignore-decorators=GLIB_VAR|GTKDOC_GNUC_CONST|BUG_711598_DEPRECATED_FOR\(.+\)',
+    '--ignore-decorators=GLIB_VAR|GTKDOC_GNUC_CONST|BUG_711598_DEPRECATED_FOR()',
     '--rebuild-types',
   ],
 )


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