[GRASS-SVN] r42440 - grass/branches/releasebranch_6_4/lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jun 2 08:56:56 EDT 2010
Author: martinl
Date: 2010-06-02 08:56:55 -0400 (Wed, 02 Jun 2010)
New Revision: 42440
Modified:
grass/branches/releasebranch_6_4/lib/python/core.py
Log:
libpython: print debug message on start_command()
(merge r42438 from trunk)
Modified: grass/branches/releasebranch_6_4/lib/python/core.py
===================================================================
--- grass/branches/releasebranch_6_4/lib/python/core.py 2010-06-02 12:54:25 UTC (rev 42439)
+++ grass/branches/releasebranch_6_4/lib/python/core.py 2010-06-02 12:56:55 UTC (rev 42440)
@@ -13,7 +13,7 @@
...
@endcode
-(C) 2008-2009 by the GRASS Development Team
+(C) 2008-2010 by the GRASS Development Team
This program is free software under the GNU General Public
License (>=v2). Read the file COPYING that comes with GRASS
for details.
@@ -56,6 +56,7 @@
STDOUT = subprocess.STDOUT
fatal_exit = True # abort on fatal()
+debug_level = 0 # DEBUG level
def call(*args, **kwargs):
return Popen(*args, **kwargs).wait()
@@ -145,6 +146,12 @@
else:
options[opt] = val
args = make_command(prog, flags, overwrite, quiet, verbose, **options)
+
+ global debug_level
+ if debug_level > 0:
+ sys.stderr.write("D1/%d: %s.start_command(): %s\n" % (debug_level, __name__, ' '.join(args)))
+ sys.stderr.flush()
+
return Popen(args, **popts)
def run_command(*args, **kwargs):
@@ -498,6 +505,8 @@
s = read_command("g.gisenv", flags='n')
return parse_key_val(s)
+debug_level = int(gisenv().get('DEBUG', 0))
+
# interface to g.region
def region():
More information about the grass-commit
mailing list