[GRASS-SVN] r42438 - grass/trunk/lib/python

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jun 2 08:50:15 EDT 2010


Author: martinl
Date: 2010-06-02 08:50:14 -0400 (Wed, 02 Jun 2010)
New Revision: 42438

Modified:
   grass/trunk/lib/python/core.py
Log:
libpython: print debug message on start_command()


Modified: grass/trunk/lib/python/core.py
===================================================================
--- grass/trunk/lib/python/core.py	2010-06-02 10:15:19 UTC (rev 42437)
+++ grass/trunk/lib/python/core.py	2010-06-02 12:50:14 UTC (rev 42438)
@@ -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