[GRASS-SVN] r60735 - grass/branches/releasebranch_7_0/lib/init
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jun 7 15:20:09 PDT 2014
Author: neteler
Date: 2014-06-07 15:20:09 -0700 (Sat, 07 Jun 2014)
New Revision: 60735
Removed:
grass/branches/releasebranch_7_0/lib/init/prompt.py
Modified:
grass/branches/releasebranch_7_0/lib/init/Makefile
grass/branches/releasebranch_7_0/lib/init/grass.py
Log:
Replaced prompt.py with a bash function for bash startup (backport from trunk, r60216 + r60222 + r60223) (trac #2284)
Modified: grass/branches/releasebranch_7_0/lib/init/Makefile
===================================================================
--- grass/branches/releasebranch_7_0/lib/init/Makefile 2014-06-07 22:15:23 UTC (rev 60734)
+++ grass/branches/releasebranch_7_0/lib/init/Makefile 2014-06-07 22:20:09 UTC (rev 60735)
@@ -25,7 +25,6 @@
$(ETC)/echo$(EXE) \
$(ETC)/license \
$(ETC)/VERSIONNUMBER \
- $(ETC)/prompt.py \
$(HTMLDIR)/help_loc_struct.png \
$(HTMLDIR)/circle_1.png \
$(HTMLDIR)/circle_2.png \
Modified: grass/branches/releasebranch_7_0/lib/init/grass.py
===================================================================
--- grass/branches/releasebranch_7_0/lib/init/grass.py 2014-06-07 22:15:23 UTC (rev 60734)
+++ grass/branches/releasebranch_7_0/lib/init/grass.py 2014-06-07 22:20:09 UTC (rev 60735)
@@ -1097,8 +1097,19 @@
else:
f.write("PS1='GRASS %s (%s):\w > '\n" % (grass_version, location_name))
- f.write("PROMPT_COMMAND=\"'%s'\"\n" % os.path.join(gisbase, 'etc',
- 'prompt.py'))
+ f.write("""grass_prompt() {
+ LOCATION="`g.gisenv GISDBASE`/`g.gisenv LOCATION_NAME`/`g.gisenv MAPSET`"
+ if test -d "$LOCATION/grid3/G3D_MASK" && test -f "$LOCATION/cell/MASK" ; then
+ echo [%s]
+ elif test -f "$LOCATION/cell/MASK" ; then
+ echo [%s]
+ elif test -d "$LOCATION/grid3/G3D_MASK" ; then
+ echo [%s]
+ fi
+}
+PROMPT_COMMAND=grass_prompt\n""" % (_("2d and 3d Raster MASKs present"),
+ _("Raster MASK present"),
+ _("3d raster MASK present")))
# read environmental variables
path = os.path.join(userhome, ".grass.bashrc") # left for backward compatibility
Deleted: grass/branches/releasebranch_7_0/lib/init/prompt.py
===================================================================
--- grass/branches/releasebranch_7_0/lib/init/prompt.py 2014-06-07 22:15:23 UTC (rev 60734)
+++ grass/branches/releasebranch_7_0/lib/init/prompt.py 2014-06-07 22:20:09 UTC (rev 60735)
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-
-import os
-import sys
-
-from grass.script import core as grass
-
-gisenv = grass.gisenv()
-
-import gettext
-gettext.install('grasslibs', os.path.join(gisenv['GISDBASE'], 'locale'), unicode = True)
-
-location = os.path.join(gisenv['GISDBASE'], gisenv['LOCATION_NAME'], gisenv['MAPSET'])
-
-has_mask = os.path.isfile(os.path.join(location, 'cell', 'MASK'))
-has_mask3d = os.path.isdir(os.path.join(location, 'grid3', 'G3D_MASK'))
-
-def main():
- if has_mask and has_mask3d:
- grass.info(_("[Raster and Volume MASKs present]"))
- elif has_mask:
- grass.info(_("[Raster MASK present]"))
- elif has_mask3d:
- grass.info(_("[Volume MASK present]"))
-
- return 0
-
-if __name__ == "__main__":
- sys.exit(main())
More information about the grass-commit
mailing list