[game-data-packager] 05/06: Move environment variable handling back to gdp/__init__.py

Simon McVittie smcv at debian.org
Mon Jan 25 10:26:30 UTC 2016


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 bb6756455712384b6795a84ea76c43ddd69d9e98
Author: Simon McVittie <smcv at debian.org>
Date:   Mon Jan 25 10:22:41 2016 +0000

    Move environment variable handling back to gdp/__init__.py
    
    This is rather useful for ancillary scripts, and isn't really
    command-line-specific.
---
 game_data_packager/__init__.py     | 5 +++++
 game_data_packager/command_line.py | 7 -------
 tools/check_syntax.py              | 6 ------
 3 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index 792625a..2c19012 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -39,6 +39,11 @@ from .version import (GAME_PACKAGE_VERSION)
 logging.basicConfig()
 logger = logging.getLogger(__name__)
 
+if os.environ.get('DEBUG') or os.environ.get('GDP_DEBUG'):
+    logging.getLogger().setLevel(logging.DEBUG)
+else:
+    logging.getLogger().setLevel(logging.INFO)
+
 MD5SUM_DIVIDER = re.compile(r' [ *]?')
 
 class GameDataPackage(object):
diff --git a/game_data_packager/command_line.py b/game_data_packager/command_line.py
index 7648783..0cf7960 100644
--- a/game_data_packager/command_line.py
+++ b/game_data_packager/command_line.py
@@ -34,13 +34,6 @@ from .util import (human_size)
 logging.basicConfig()
 logger = logging.getLogger(__name__)
 
-# For now, we're given these by the shell script wrapper.
-
-if os.environ.get('DEBUG') or os.environ.get('GDP_DEBUG'):
-    logging.getLogger().setLevel(logging.DEBUG)
-else:
-    logging.getLogger().setLevel(logging.INFO)
-
 class TerminalProgress(ProgressCallback):
     def __init__(self, interval=0.2):
         """Constructor.
diff --git a/tools/check_syntax.py b/tools/check_syntax.py
index 21f0838..a1d8f99 100755
--- a/tools/check_syntax.py
+++ b/tools/check_syntax.py
@@ -15,18 +15,12 @@
 # You can find the GPL license text on a Debian system under
 # /usr/share/common-licenses/GPL-2.
 
-import logging
 import os
 import yaml
 
 from game_data_packager import load_games
 from game_data_packager.util import ascii_safe
 
-if os.environ.get('DEBUG') or os.environ.get('GDP_DEBUG'):
-    logging.getLogger().setLevel(logging.DEBUG)
-else:
-    logging.getLogger().setLevel(logging.INFO)
-
 if __name__ == '__main__':
     for name, game in load_games().items():
         game.load_file_data()

-- 
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