[gobject-introspection] Save preprocessor input and output files with save-temps



commit d0216ccbfe3456b95157b05cc31d0f3e8a256d69
Author: Tomasz Miąsko <tomasz miasko gmail com>
Date:   Mon Dec 17 00:00:00 2018 +0000

    Save preprocessor input and output files with save-temps
    
    When using `GI_SCANNER_DEBUG=save-temps`, the temporary input file
    to be preprocessed and temporary output file that is result of this
    preprocessing are retained for debugging purposes. Use together with
    `-v` option to actually determine names of those temporary files.
    
    This should make it easier to determine the source of parsing errors,
    like those described in the #247.

 giscanner/sourcescanner.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py
index d6cb92af..471131c2 100644
--- a/giscanner/sourcescanner.py
+++ b/giscanner/sourcescanner.py
@@ -24,6 +24,7 @@ import tempfile
 from .libtoolimporter import LibtoolImporter
 from .message import Position
 from .ccompiler import CCompiler
+from .utils import have_debug_flag
 
 with LibtoolImporter(None, None):
     if 'UNINSTALLED_INTROSPECTION_SRCDIR' in os.environ:
@@ -303,9 +304,11 @@ class SourceScanner(object):
                       tmpfile_output,
                       self._cpp_options)
 
-        os.unlink(tmp_name_cpp)
+        if not have_debug_flag('save-temps'):
+            os.unlink(tmp_name_cpp)
         self._scanner.parse_file(tmpfile_output)
-        os.unlink(tmpfile_output)
+        if not have_debug_flag('save-temps'):
+            os.unlink(tmpfile_output)
 
     def _write_preprocess_src(self, fp, defines, undefs, filenames):
         # Write to the temp file for feeding into the preprocessor


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