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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jan 26 05:48:02 EST 2011


Author: martinl
Date: 2011-01-26 02:48:02 -0800 (Wed, 26 Jan 2011)
New Revision: 45189

Modified:
   grass/trunk/lib/python/core.py
   grass/trunk/lib/python/pythonlib.dox
Log:
pythonlib: core::version introduced


Modified: grass/trunk/lib/python/core.py
===================================================================
--- grass/trunk/lib/python/core.py	2011-01-26 10:44:29 UTC (rev 45188)
+++ grass/trunk/lib/python/core.py	2011-01-26 10:48:02 UTC (rev 45189)
@@ -1065,7 +1065,22 @@
         os.chdir(cur_dir)
     except OSError, e:
         raise ScriptException(repr(e))
-    
+
+# interface to g.version
+
+def version():
+    """!Get GRASS version as dictionary
+
+    @code
+    version()
+
+    {'date': '2011', 'gis_revision': 'Revision: 45093 ', 'version': '7.0.svn',
+     'gis_date': 'Date: 2011-01-20 13:10:50 +0100 (Thu, 20 Jan 2011) ', 'revision': '45136M'}
+    @endcode
+    """
+    return parse_command('g.version',
+                         flags = 'rg')
+
 # 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	2011-01-26 10:44:29 UTC (rev 45188)
+++ grass/trunk/lib/python/pythonlib.dox	2011-01-26 10:48:02 UTC (rev 45189)
@@ -171,6 +171,10 @@
 
  - python::core::mapsets()
 
+<b>Interface to g.version</b>
+
+ - python::core::version()
+
 <b>Color parsing</b>
 
  - python::core::parse_color()



More information about the grass-commit mailing list