[GRASS-SVN] r43995 - grass/trunk/lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Oct 24 02:30:47 EDT 2010
Author: martinl
Date: 2010-10-23 23:30:47 -0700 (Sat, 23 Oct 2010)
New Revision: 43995
Modified:
grass/trunk/lib/python/core.py
grass/trunk/lib/python/pythonlib.dox
Log:
pythonlib: fn mapsets() added
Modified: grass/trunk/lib/python/core.py
===================================================================
--- grass/trunk/lib/python/core.py 2010-10-22 07:49:28 UTC (rev 43994)
+++ grass/trunk/lib/python/core.py 2010-10-24 06:30:47 UTC (rev 43995)
@@ -863,6 +863,28 @@
return cmdinfo
+# interface to g.mapsets
+
+def mapsets(accessible = True):
+ """!List accessible mapsets (mapsets in search path)
+
+ @param accessible False to list all mapsets in the location
+
+ @return list of mapsets
+ """
+ if accessible:
+ flags = 'p'
+ else:
+ flags = 'l'
+ mapsets = read_command('g.mapsets',
+ flags = flags,
+ fs = 'newline',
+ quiet = True)
+ if not mapsets:
+ fatal(_("Unable to list mapsets"))
+
+ return mapsets.splitlines()
+
# get debug_level
if find_program('g.gisenv', ['--help']):
debug_level = int(gisenv().get('DEBUG', 0))
Modified: grass/trunk/lib/python/pythonlib.dox
===================================================================
--- grass/trunk/lib/python/pythonlib.dox 2010-10-22 07:49:28 UTC (rev 43994)
+++ grass/trunk/lib/python/pythonlib.dox 2010-10-24 06:30:47 UTC (rev 43995)
@@ -167,6 +167,10 @@
- mlist_grouped()
+<b>Interface to g.mapsets</b>
+
+ - mapsets()
+
<b>Color parsing</b>
- parse_color()
More information about the grass-commit
mailing list