فهرست منبع

don't hardcode python.exe, quote shell vars (merge from devbr6)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@37652 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman 16 سال پیش
والد
کامیت
1f168ffdc3

+ 1 - 0
gui/wxpython/scripts/Makefile

@@ -7,6 +7,7 @@ ETCDIR = $(ETC)/gui/scripts
 default: install_scripts
 
 install_scripts:
+	if [ ! -d $(ETC)/gui ] ; then $(MKDIR) $(ETC)/gui ; fi
 	if [ ! -d $(ETCDIR) ] ; then $(MKDIR) $(ETCDIR) ; fi
 	$(MAKE) $(ETCDIR)/d.rast3d
 

+ 2 - 2
gui/wxpython/scripts/p.cmd

@@ -36,7 +36,7 @@ cmdfile="`g.gisenv get=GRASS_PYCMDFILE`"
 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 @@ cmd="${GIS_OPT_CMD}"
 
 g.message -d message="$0: ${cmd}"
 
-echo ${cmd} >> ${cmdfile}
+echo "${cmd}" >> "${cmdfile}"
 
 exit 0

+ 6 - 2
gui/wxpython/scripts/p.db

@@ -23,10 +23,14 @@ fi
 
 # CODE GOES HERE
 
-PYTHONPATH="$GISBASE/etc/wxpython"
 
+if [ -z "$PYTHONPATH" ] ; then
+   PYTHONPATH="$GISBASE/etc/wxpython"
+else
+   PYTHONPATH="$GISBASE/etc/wxpython:$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

+ 7 - 4
gui/wxpython/scripts/p.mon

@@ -64,8 +64,11 @@ fi
 
 # CODE GOES HERE
 
-PYTHONPATH="$GISBASE/etc/wxpython"
-
+if [ -z "$PYTHONPATH" ] ; then
+   PYTHONPATH="$GISBASE/etc/wxpython"
+else
+   PYTHONPATH="$GISBASE/etc/wxpython:$PYTHONPATH"
+fi
 export PYTHONPATH
 
 start="$GIS_OPT_START"
@@ -75,10 +78,10 @@ unlock="$GIS_OPT_UNLOCK"
 
 # 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

+ 4 - 4
gui/wxpython/scripts/p.rast

@@ -58,12 +58,12 @@ cmdfile="`g.gisenv get=GRASS_PYCMDFILE`"
 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 @@ fi
 
 cmd="addraster ${name} ${mapset} ${CATLIST} ${VALLIST} ${INVERT} ${OPACITY}"
 
-#echo ${cmd}
-echo ${cmd} >>${cmdfile}
+#echo "${cmd}"
+echo "${cmd}" >> "${cmdfile}"

+ 3 - 3
gui/wxpython/scripts/p.vect

@@ -282,12 +282,12 @@ cmdfile="`g.gisenv get=GRASS_PYCMDFILE`"
 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 @@ fi
 #cmd="self.map.AddRasterLayer(self, $NAME $MAPSET $CATLIST $VALLIST $INVERCATS $INVERT $OPACITY)"
 
 cmd="addvector ${name} ${mapset}"
-echo ${cmd} >>${cmdfile}
+echo "${cmd}" >> "${cmdfile}"

+ 8 - 3
gui/wxpython/wxgui

@@ -16,8 +16,13 @@ if [ -z "$GISBASE" ] ; then
     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 @@ fi
 
 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