[GRASS-SVN] r37834 - grass/branches/releasebranch_6_4/macosx/app

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jun 11 17:05:56 EDT 2009


Author: kyngchaos
Date: 2009-06-11 17:05:56 -0400 (Thu, 11 Jun 2009)
New Revision: 37834

Modified:
   grass/branches/releasebranch_6_4/macosx/app/grass.sh.in
Log:
attempt to use same version of Python that wxPython was built for, when bundling wxPython (from dev6 r37833)

Modified: grass/branches/releasebranch_6_4/macosx/app/grass.sh.in
===================================================================
--- grass/branches/releasebranch_6_4/macosx/app/grass.sh.in	2009-06-11 21:03:04 UTC (rev 37833)
+++ grass/branches/releasebranch_6_4/macosx/app/grass.sh.in	2009-06-11 21:05:56 UTC (rev 37834)
@@ -137,6 +137,7 @@
 
 ### X11 stuff
 
+x11=""
 if [ "@X11@" ] ; then
 
 # start X11 if not running
@@ -148,6 +149,9 @@
 		if [ ! "`ps -axc | grep 'X11$'`" ] ; then
 			open /Applications/Utilities/X11.app
 		fi
+		x11="tig"
+	else
+		x11="leo"
 	fi
 fi
 
@@ -173,18 +177,56 @@
 
 ### end X11 block
 
-# set PYTHONPATH for GUI when bundling wxpython
+# for bundling wxpython
+# change GRASS_WXBUNDLED and pyver_want here from bundle.make, or manually
 GRASS_WXBUNDLED=
 export GRASS_WXBUNDLED
+pyver_want="2.5"
 if [ -d "$GISBASE/etc/wxpython" ] && [ "$GRASS_WXBUNDLED" = "1" ] ; then
-if [ "$PYTHONPATH" ] ; then
-	PYTHONPATH="$GISBASE/etc/wxpython:$PYTHONPATH"
-else
-	PYTHONPATH="$GISBASE/etc/wxpython"
+# make sure python version used matches what wxpython wants
+py=""
+# did user set GRASS_PYTHON already? check it
+if [ "$GRASS_PYTHON" ] ; then
+	pyver=`$GRASS_PYTHON -V 2>&1 | grep " $pyver_want"`
+	if [ "$pyver" ] ; then
+		py="$GRASS_PYTHON"
+	fi
+fi # GRASS_PYTHON
+# try in shell path
+if [ ! "$py" ] ; then
+	py=`type -p python`
+	if [ "$py" ] ; then
+		pyver=`python -V 2>&1 | grep " $pyver_want"`
+		if [ ! "$pyver" ] ; then
+			py=""
+		fi
+	fi
 fi
-export PYTHONPATH
+# try standard framework
+if [ ! "$py" ] ; then
+	py="/Library/Frameworks/Python.framework/Versions/$pyver_want/bin/python"
+	if [ ! -x "$py" ] ; then
+		py=""
+	fi
 fi
+# try system (may be the same as in shell path)
+if [ ! "$py" ] ; then
+	py="/usr/bin/python"
+	pyver=`$py -V 2>&1 | grep " $pyver_want"`
+	if [ ! "$pyver" ] ; then
+		py=""
+	fi
+fi
 
+if [ "$py" ] ; then
+	echo "$pyver found."
+	GRASS_PYTHON="$py"
+else
+	echo "Warning: No Python $pyver_want found, needed by wxPython."
+	echo "         The wxPython GUI may not work properly."
+fi
+fi # bundled wx
+
 # if gisrc has text startup, switch back to Terminal (gotta duplicate some init.sh stuff)
 # eventually, when TclTk optional, can run appropriate apps per GUI here (ie X11)
 GISRCRC="$HOME/.grassrc6"
@@ -196,7 +238,7 @@
 		GRASS_GUI="tcltk"
 	fi
 fi
-if [ "$GRASS_GUI" = "text" ] ; then
+if [ "$GRASS_GUI" = "text" ] && [ "$x11" = "tig" ] ; then
 	osascript -e "tell application \"$USERTERM\" to activate"
 fi
 



More information about the grass-commit mailing list