diff options
author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2018-12-17 00:00:00 +0000 |
---|---|---|
committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2018-12-17 14:15:05 +0100 |
commit | d0216ccbfe3456b95157b05cc31d0f3e8a256d69 (patch) | |
tree | d23c1dd3c494c5a6428a4de507d82cd00b20180b | |
parent | 30e2a6e0816b731f24ce4d0919a8770705fe30d2 (diff) | |
download | gobject-introspection-d0216ccbfe3456b95157b05cc31d0f3e8a256d69.tar.gz |
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.
-rw-r--r-- | giscanner/sourcescanner.py | 7 |
1 files 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 |