[game-data-packager] 01/09: Add --debug option which does the same as DEBUG=1

Simon McVittie smcv at debian.org
Sun Oct 25 22:13:36 UTC 2015


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch master
in repository game-data-packager.

commit f0d08ff7e526e66a2841bce8ad979fbc993b0741
Author: Simon McVittie <smcv at debian.org>
Date:   Sat Oct 24 18:25:52 2015 +0100

    Add --debug option which does the same as DEBUG=1
    
    This is considerably more discoverable.
---
 game_data_packager/__init__.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index 2b42d9f..8649e46 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -943,7 +943,8 @@ class GameData(object):
         return gog.get('game', gog['url'])
 
 def load_games(game='*'):
-    progress = game == '*' and sys.stderr.isatty()
+    progress = (game == '*' and sys.stderr.isatty() and
+            not logging.getLogger().isEnabledFor(logging.DEBUG))
     games = {}
 
     if USE_VFS:
@@ -1048,6 +1049,13 @@ def run_command_line():
             dest='verbose', help='hide output from external '
              'tools (default)')
 
+    class DebugAction(argparse.Action):
+        def __call__(self, parser, namespace, values, option_string=None):
+            logging.getLogger().setLevel(logging.DEBUG)
+
+    base_parser.add_argument('--debug', action=DebugAction, nargs=0,
+            help='show debug messages')
+
     class DumbParser(argparse.ArgumentParser):
         def error(self, message):
             pass

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list