From cb268efadd68c0d67965e683a26966d760cd33ca Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 25 Jun 2010 13:23:49 -0400 Subject: In verbose mode, print out the dump compilation When debugging the dumper, it's extremely useful to be able to see the argument it's passing to the compiler/linker. This patch makes g-ir-scanner work the same way as libtool basically; we default to printing out stuff, and add a --quiet option. The Makefile.introspection handles passing --quiet automatically. https://bugzilla.gnome.org/show_bug.cgi?id=622751 --- Makefile.introspection | 12 ++++++++---- docs/g-ir-scanner.1 | 3 +++ giscanner/dumper.py | 4 ++++ giscanner/scannermain.py | 5 +++++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Makefile.introspection b/Makefile.introspection index bd25ef16..5edccbe0 100644 --- a/Makefile.introspection +++ b/Makefile.introspection @@ -65,9 +65,12 @@ _gir_libtool = $(if $(LIBTOOL),--libtool="$(LIBTOOL)") # Macros for AM_SILENT_RULES prettiness _gir_verbosity = $(if $(AM_DEFAULT_VERBOSITY),$(AM_DEFAULT_VERBOSITY),1) -_gir_silent_scanner = $(_gir_silent_scanner_$(V)) -_gir_silent_scanner_ = $(_gir_silent_scanner_$(_gir_verbosity)) -_gir_silent_scanner_0 = @echo " GISCAN $(1)"; +_gir_silent_scanner_prefix = $(_gir_silent_scanner_prefix_$(V)) +_gir_silent_scanner_prefix_ = $(_gir_silent_scanner_prefix_$(_gir_verbosity)) +_gir_silent_scanner_prefix_0 = @echo " GISCAN $(1)"; +_gir_silent_scanner_opts = $(_gir_silent_scanner_opts_$(V)) +_gir_silent_scanner_opts_ = $(_gir_silent_scanner_opts_$(_gir_verbosity)) +_gir_silent_scanner_opts_0 = --quiet _gir_silent_compiler = $(_gir_silent_compiler_$(V)) _gir_silent_compiler_ = $(_gir_silent_compiler_$(_gir_verbosity)) @@ -116,7 +119,8 @@ $(if $(or $($(_gir_name)_LIBS), # sure these are built before running the scanner. Libraries and programs # needs to be added manually. $(1): $$($(_gir_name)_FILES) - $(_gir_silent_scanner) $(INTROSPECTION_SCANNER) $(INTROSPECTION_SCANNER_ARGS) \ + $(_gir_silent_scanner_prefix) $(INTROSPECTION_SCANNER) $(_gir_silent_scanner_opts) \ + $(INTROSPECTION_SCANNER_ARGS) \ --namespace=$(_gir_namespace) \ --nsversion=$(_gir_version) \ $(_gir_libtool) \ diff --git a/docs/g-ir-scanner.1 b/docs/g-ir-scanner.1 index 5089e6b5..b43d3f18 100644 --- a/docs/g-ir-scanner.1 +++ b/docs/g-ir-scanner.1 @@ -18,6 +18,9 @@ header file (.h). Currently only C based libraries are supported by the scanner. .B \--help Show help options .TP +.B \--quiet +If passed, do not print details of normal operation. +.TP .B \--warn-all Display warnings for public API which is not introspectable. .TP diff --git a/giscanner/dumper.py b/giscanner/dumper.py index d72e40e0..78b44e5b 100644 --- a/giscanner/dumper.py +++ b/giscanner/dumper.py @@ -172,6 +172,8 @@ class DumpCompiler(object): raise CompilerError( "Could not find c source file: %s" % (source, )) args.extend(list(sources)) + if not self._options.quiet: + print "g-ir-scanner: compile: %r" % (args, ) subprocess.check_call(args) def _link(self, output, *sources): @@ -228,6 +230,8 @@ class DumpCompiler(object): "Could not find object file: %s" % (source, )) args.extend(list(sources)) + if not self._options.quiet: + print "g-ir-scanner: link: %r" % (args, ) subprocess.check_call(args) diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py index be590f1a..363f6f6d 100644 --- a/giscanner/scannermain.py +++ b/giscanner/scannermain.py @@ -37,6 +37,11 @@ from giscanner.transformer import Transformer def _get_option_parser(): parser = optparse.OptionParser('%prog [options] sources') + parser.add_option('', "--quiet", + action="store_true", dest="quiet", + default=False, + help="If passed, do not print details of normal" \ + + " operation") parser.add_option("", "--format", action="store", dest="format", default="gir", -- cgit v1.2.1