[GRASS-SVN] r38862 - grass/trunk/scripts/v.build.all
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Aug 25 12:08:38 EDT 2009
Author: martinl
Date: 2009-08-25 12:08:38 -0400 (Tue, 25 Aug 2009)
New Revision: 38862
Modified:
grass/trunk/scripts/v.build.all/v.build.all.py
Log:
v.build.all - be less verbose
Modified: grass/trunk/scripts/v.build.all/v.build.all.py
===================================================================
--- grass/trunk/scripts/v.build.all/v.build.all.py 2009-08-25 16:02:40 UTC (rev 38861)
+++ grass/trunk/scripts/v.build.all/v.build.all.py 2009-08-25 16:08:38 UTC (rev 38862)
@@ -4,7 +4,7 @@
# MODULE: v.build.all
# AUTHOR(S): Glynn Clements, Radim Blazek
# PURPOSE: Build all vectors in current mapset
-# COPYRIGHT: (C) 2004,2008 by the GRASS Development Team
+# COPYRIGHT: (C) 2004, 2008-2009 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
@@ -12,10 +12,10 @@
#
#############################################################################
-#%Module
+#%module
#% description: Rebuilds topology on all vector maps in the current mapset.
-#% keywords: vector
-#%End
+#% keywords: vector, topology
+#%end
import sys
from grass.script import core as grass
@@ -24,14 +24,28 @@
env = grass.gisenv()
mapset = env['MAPSET']
ret = 0
- for vect in grass.list_grouped('vect')[mapset]:
+
+ vectors = grass.list_grouped('vect')[mapset]
+ num_vectors = len(vectors)
+
+ if grass.verbosity() < 2:
+ quiet = True
+ else:
+ quiet = False
+
+ i = 1
+ for vect in vectors:
map = "%s@%s" % (vect, mapset)
- grass.message(_("Build topology for vector '%s'") % map)
- grass.message(_("v.build map=%s") % map)
- if grass.run_command("v.build", map = map) != 0:
+ grass.message(_("Build topology for vector map <%s> (%d of %d)...") % \
+ (map, i, num_vectors))
+ grass.verbose(_("v.build map=%s") % map)
+ if grass.run_command("v.build", map = map, quiet = quiet) != 0:
+ grass.error(_("Building topology for vector map <%s> failed") % map)
ret = 1
- sys.exit(ret)
+ i += 1
+
+ return ret
if __name__ == "__main__":
options, flags = grass.parser()
- main()
+ sys.exit(main())
More information about the grass-commit
mailing list