[GRASS-SVN] r37650 - in grass/branches/releasebranch_6_4/gui/wxpython: . scripts

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 31 08:38:28 EDT 2009


Author: hamish
Date: 2009-05-31 08:38:28 -0400 (Sun, 31 May 2009)
New Revision: 37650

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.cmd
   grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.db
   grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.mon
   grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.rast
   grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.vect
   grass/branches/releasebranch_6_4/gui/wxpython/wxgui
Log:
don't hardcode python.exe, quote shell vars

Modified: grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.cmd
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.cmd	2009-05-31 12:18:58 UTC (rev 37649)
+++ grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.cmd	2009-05-31 12:38:28 UTC (rev 37650)
@@ -36,7 +36,7 @@
 if [ -e ${cmdfile} ] && [ -n "${cmdfile}" ]; then
     :
 else
-    g.message -e "GRASS_PYCMDFILE File not found. Run p.mon"
+    g.message -e "GRASS_PYCMDFILE - File not found. Run p.mon"
     exit 1
 fi
 
@@ -44,6 +44,6 @@
 
 g.message -d message="$0: ${cmd}"
 
-echo ${cmd} >> ${cmdfile}
+echo "${cmd}" >> "${cmdfile}"
 
 exit 0

Modified: grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.db
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.db	2009-05-31 12:18:58 UTC (rev 37649)
+++ grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.db	2009-05-31 12:38:28 UTC (rev 37650)
@@ -23,10 +23,13 @@
 
 # CODE GOES HERE
 
-PYTHONPATH="$GISBASE/etc/wx"
-
+if [ -z "$PYTHONPATH" ] ; then
+   PYTHONPATH="$GISBASE/etc/wx"
+else
+   PYTHONPATH="$GISBASE/etc/wx:$PYTHONPATH"
+fi
 export PYTHONPATH
 
-python $PYTHONPATH/gui_modules/dbm.py $GIS_OPT_TABLE
+"$GRASS_PYTHON" "$PYTHONPATH/gui_modules/dbm.py" "$GIS_OPT_TABLE"
 
 exit 0

Modified: grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.mon
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.mon	2009-05-31 12:18:58 UTC (rev 37649)
+++ grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.mon	2009-05-31 12:38:28 UTC (rev 37650)
@@ -64,8 +64,11 @@
 
 # CODE GOES HERE
 
-PYTHONPATH="$GISBASE/etc/wx"
-
+if [ -z "$PYTHONPATH" ] ; then
+   PYTHONPATH="$GISBASE/etc/wx"
+else
+   PYTHONPATH="$GISBASE/etc/wx:$PYTHONPATH"
+fi
 export PYTHONPATH
 
 start="$GIS_OPT_START"
@@ -75,10 +78,10 @@
 
 # create the command file
 command_file="`g.tempfile pid=$$`"
-g.gisenv set=GRASS_PYCMDFILE=${command_file}
+g.gisenv set="GRASS_PYCMDFILE=${command_file}"
 
 if [ -n "$start" ] ; then
-    python $PYTHONPATH/gui_modules/mapdisp.py "$start" ${command_file} &
+    "$GRASS_PYTHON" "$PYTHONPATH/gui_modules/mapdisp.py" "$start" "${command_file}" &
 fi
 
 if [[ -n "$stop" || -n "$select" || -n "$unlock" ]] ; then

Modified: grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.rast
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.rast	2009-05-31 12:18:58 UTC (rev 37649)
+++ grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.rast	2009-05-31 12:38:28 UTC (rev 37650)
@@ -58,12 +58,12 @@
 if [ -e ${cmdfile} ] && [ -n "${cmdfile}" ]; then
     echo -n
 else
-    g.message -e "GRASS_PYCMDFILE File not found. Run p.mon"
+    g.message -e "GRASS_PYCMDFILE - File not found. Run p.mon"
     exit 1
 fi
 
 
-eval "`echo ${GIS_OPT_MAP}| sed -e 's/^/NAME=/' -e 's/@/; MAPSET=/'`;"
+eval "`echo ${GIS_OPT_MAP} | sed -e 's/^/NAME=/' -e 's/@/; MAPSET=/'`;"
 
 #echo $NAME 
 
@@ -109,5 +109,5 @@
 
 cmd="addraster ${name} ${mapset} ${CATLIST} ${VALLIST} ${INVERT} ${OPACITY}"
 
-#echo ${cmd}
-echo ${cmd} >>${cmdfile}
+#echo "${cmd}"
+echo "${cmd}" >> "${cmdfile}"

Modified: grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.vect
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.vect	2009-05-31 12:18:58 UTC (rev 37649)
+++ grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.vect	2009-05-31 12:38:28 UTC (rev 37650)
@@ -282,12 +282,12 @@
 if [ -e ${cmdfile} ] && [ -n "${cmdfile}" ]; then
     echo -n
 else
-    echo "WARNING: GRASS_PYCMDFILE File not existing. Run p.mon" >&2
+    echo "WARNING: GRASS_PYCMDFILE - File not found. Run p.mon" >&2
     exit 1
 fi
 
 
-eval "`echo ${GIS_OPT_MAP}| sed -e 's/^/NAME=/' -e 's/@/; MAPSET=/'`;"
+eval "`echo ${GIS_OPT_MAP} | sed -e 's/^/NAME=/' -e 's/@/; MAPSET=/'`;"
 
 #echo $NAME 
 
@@ -332,4 +332,4 @@
 #cmd="self.map.AddRasterLayer(self, $NAME $MAPSET $CATLIST $VALLIST $INVERCATS $INVERT $OPACITY)"
 
 cmd="addvector ${name} ${mapset}"
-echo ${cmd} >>${cmdfile}
+echo "${cmd}" >> "${cmdfile}"

Modified: grass/branches/releasebranch_6_4/gui/wxpython/wxgui
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/wxgui	2009-05-31 12:18:58 UTC (rev 37649)
+++ grass/branches/releasebranch_6_4/gui/wxpython/wxgui	2009-05-31 12:38:28 UTC (rev 37650)
@@ -16,8 +16,13 @@
     exit 1
 fi
 
+if [ -z "$GRASS_PYTHON" ] ; then
+    g.message -e "GRASS_PYTHON environment variable not set"
+    exit 1
+fi
+
 if [ $# -eq 0 ] ; then
-    python "$GISBASE/etc/wxpython/wxgui.py" &
+    "$GRASS_PYTHON" "$GISBASE/etc/wxpython/wxgui.py" &
     exit 0
 fi
 
@@ -27,9 +32,9 @@
 
 if test -n "$GIS_OPT_WORKSPACE" ; then
     # load workspace file
-    python "$GISBASE/etc/wxpython/wxgui.py" "--workspace" "$GIS_OPT_WORKSPACE" &
+    "$GRASS_PYTHON" "$GISBASE/etc/wxpython/wxgui.py" "--workspace" "$GIS_OPT_WORKSPACE" &
 else
-    python "$GISBASE/etc/wxpython/wxgui.py" &
+    "$GRASS_PYTHON" "$GISBASE/etc/wxpython/wxgui.py" &
 fi
 
 exit 0



More information about the grass-commit mailing list