From a0e66acd2bcafab4d6c8ba7739d368ca24e06603 Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Wed, 21 Nov 2007 17:44:09 +0100 Subject: [PATCH] Add configure option --enable-debug This is mostly developer help: To easily enable debug messages --- Dragbox/globals.py.in | 5 +++-- Dragbox/utils.py | 4 ++-- configure.ac | 7 ++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Dragbox/globals.py.in b/Dragbox/globals.py.in index 2f06ac9..55c0bef 100644 --- a/Dragbox/globals.py.in +++ b/Dragbox/globals.py.in @@ -27,7 +27,8 @@ glade_directory = "@GLADEDIR@" version = "@VERSION@" pref_id = "/apps/@PACKAGE@/" dbus_enabled = "@DBUS_ENABLED@" +debug_enabled = "@DEBUG_ENABLED@" -copyright_info = """(C) 2006, Ulrik Sverdrup +copyright_info = """(C) 2006, 2007, Ulrik Sverdrup dragbox is free software; it is distributed under -the terms of the GNU General Public License.""" \ No newline at end of file +the terms of the GNU General Public License.""" diff --git a/Dragbox/utils.py b/Dragbox/utils.py index a8fd80e..5aaf249 100644 --- a/Dragbox/utils.py +++ b/Dragbox/utils.py @@ -89,8 +89,8 @@ def print_debug(string): Convenience method writes an debug message to stderr, with a special prefix """ - debug = False - if debug: + from globals import debug_enabled + if debug_enabled in "yes": string = str(string) from sys import stderr stderr.write("Debug: " + string + "\n") diff --git a/configure.ac b/configure.ac index 18797ed..68d3e37 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,10 @@ AC_ARG_ENABLE(dbus, [dbus_enabled=$enableval], [dbus_enabled=yes]) - +AC_ARG_ENABLE(debug, + AS_HELP_STRING(--enable-debug, enable debug @<:@default=no@:>@), + [debug_enabled=$enableval], + [debug_enabled=no]) dnl dnl check for python2.4 @@ -40,6 +43,7 @@ then fi AS_AC_EXPAND(DBUS_ENABLED, $dbus_enabled) +AS_AC_EXPAND(DEBUG_ENABLED, $debug_enabled) dnl dnl make sure we output gladedir expanded to our python files @@ -66,3 +70,4 @@ echo echo Ready to build dragbox echo Options echo dbus ....... $dbus_enabled +echo debug ...... $debug_enabled -- 2.11.4.GIT