Quellcode durchsuchen

pythonlib: core::version introduced

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@45189 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa vor 14 Jahren
Ursprung
Commit
2c38caaa8b
2 geänderte Dateien mit 20 neuen und 1 gelöschten Zeilen
  1. 16 1
      lib/python/core.py
  2. 4 0
      lib/python/pythonlib.dox

+ 16 - 1
lib/python/core.py

@@ -1065,7 +1065,22 @@ def _create_location_xy(database, location):
         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))

+ 4 - 0
lib/python/pythonlib.dox

@@ -171,6 +171,10 @@ Returns the name of a temporary file, created with g.tempfile.
 
  - python::core::mapsets()
 
+<b>Interface to g.version</b>
+
+ - python::core::version()
+
 <b>Color parsing</b>
 
  - python::core::parse_color()