[GRASS-SVN] r64470 - grass/trunk/lib/python/temporal
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Feb 5 04:22:04 PST 2015
Author: huhabla
Date: 2015-02-05 04:22:04 -0800 (Thu, 05 Feb 2015)
New Revision: 64470
Modified:
grass/trunk/lib/python/temporal/c_libraries_interface.py
Log:
temporal library: Trying to partly fix #2337
Modified: grass/trunk/lib/python/temporal/c_libraries_interface.py
===================================================================
--- grass/trunk/lib/python/temporal/c_libraries_interface.py 2015-02-04 21:15:25 UTC (rev 64469)
+++ grass/trunk/lib/python/temporal/c_libraries_interface.py 2015-02-05 12:22:04 UTC (rev 64470)
@@ -148,35 +148,37 @@
:returns: Names of available mapsets as list of strings
"""
-
- mapsets = libgis.G_get_available_mapsets()
-
+
count = 0
mapset_list = []
- while mapsets[count]:
- char_list = ""
- mapset = mapsets[count]
- if libgis.G_mapset_permissions(mapset) > 0:
+ try:
+ mapsets = libgis.G_get_available_mapsets()
+ while mapsets[count]:
+ char_list = ""
+ mapset = mapsets[count]
+ if libgis.G_mapset_permissions(mapset) > 0:
+ c = 0
+ while mapset[c] != "\x00":
+ char_list += mapset[c]
+ c += 1
+ mapset_list.append(char_list)
count += 1
- c = 0
- while mapset[c] != "\x00":
- char_list += mapset[c]
- c += 1
- mapset_list.append(char_list)
+ # We need to sort the mapset list, but the first one should be
+ # the current mapset
+ current_mapset = libgis.G_mapset()
+ if current_mapset in mapset_list:
+ mapset_list.remove(current_mapset)
+ mapset_list.sort()
+ mapset_list.reverse()
+ mapset_list.append(current_mapset)
+ mapset_list.reverse()
+ except:
+ raise
+ finally:
+ conn.send(mapset_list)
- # We need to sort the mapset list, but the first one should be
- # the current mapset
- current_mapset = libgis.G_mapset()
- mapset_list.remove(current_mapset)
- mapset_list.sort()
- mapset_list.reverse()
- mapset_list.append(current_mapset)
- mapset_list.reverse()
- conn.send(mapset_list)
-
-
def _has_timestamp(lock, conn, data):
"""Check if the file based GRASS timestamp is present and send
True or False using the provided pipe.
More information about the grass-commit
mailing list