[GRASS-SVN] r48310 - grass/trunk/lib/init
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Sep 15 21:16:43 EDT 2011
Author: lucadelu
Date: 2011-09-15 18:16:43 -0700 (Thu, 15 Sep 2011)
New Revision: 48310
Modified:
grass/trunk/lib/init/grass.py
Log:
add revision parameter to --config option
Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py 2011-09-15 23:39:19 UTC (rev 48309)
+++ grass/trunk/lib/init/grass.py 2011-09-16 01:16:43 UTC (rev 48310)
@@ -177,7 +177,7 @@
_("use $DEFAULT_GUI graphical user interface"),
_("and set as default"),
_("print GRASS configuration parameters"),
- _("options: arch,build,compiler,path"),
+ _("options: arch,build,compiler,path,revision"),
_("Parameters"),
_("initial database (path to GIS data)"),
_("initial location"),
@@ -874,7 +874,7 @@
params = sys.argv[2:]
if not params:
- params = ['arch', 'build', 'compiler', 'path']
+ params = ['arch', 'build', 'compiler', 'path', 'revision']
for arg in params:
if arg == 'path':
@@ -886,10 +886,18 @@
build = os.path.join(gisbase,'include','grass','confparms.h')
filebuild = open(build)
val = filebuild.readline()
+ filebuild.close()
sys.stdout.write("%s\n" % val.strip().strip('"').strip())
elif arg == 'compiler':
val = grep('CC',linesplat)
sys.stdout.write("%s\n" % val[0].split('=')[1].strip())
+ elif arg == 'revision':
+ rev = os.path.join(gisbase,'include','grass','gis.h')
+ filerev = open(rev)
+ linesrev = filerev.readlines()
+ val = grep('#define GIS_H_VERSION', linesrev)
+ filerev.close()
+ sys.stdout.write("%s\n" % val[0].split(':')[1].rstrip('$"\n').strip())
else:
message(_("Parameter <%s> not supported") % arg)
More information about the grass-commit
mailing list