[GRASS-SVN] r40105 - in grass/trunk/macosx: . app
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Dec 21 22:30:38 EST 2009
Author: kyngchaos
Date: 2009-12-21 22:30:37 -0500 (Mon, 21 Dec 2009)
New Revision: 40105
Added:
grass/trunk/macosx/app/python_wrapper
Modified:
grass/trunk/macosx/Makefile
grass/trunk/macosx/app/Makefile
grass/trunk/macosx/app/grass.sh.in
Log:
use python wrapper script so arch command can be used to select OSX architecture and to force pythonw (sync from dev6 r40103)
remove old monitorcap processing
Modified: grass/trunk/macosx/Makefile
===================================================================
--- grass/trunk/macosx/Makefile 2009-12-22 02:58:15 UTC (rev 40104)
+++ grass/trunk/macosx/Makefile 2009-12-22 03:30:37 UTC (rev 40105)
@@ -97,7 +97,6 @@
if [ ${LOCALE} -eq 1 ] ; then cd ${GISBASE} ; tar cBf - locale | (cd ${INST_DIR_TARGET} ; tar xBf - ) 2>/dev/null ; fi
-cd ${GISBASE} ; tar cBf - include | (cd ${INST_DIR_TARGET} ; tar xBf - ) 2>/dev/null
-cd ${GISBASE} ; tar cBf - lib | (cd ${INST_DIR_TARGET} ; tar xBf - ) 2>/dev/null
- -sed 's#'${GISBASE}'#'${INST_DIR_TARGET}'#g' ${GISBASE}/etc/monitorcap > ${INST_DIR_TARGET}/etc/monitorcap
-chmod -R a+rX ${PREFIX_TARGET}/${MACOSX_APP_NAME} 2>/dev/null
@#-cd ${GRASS_HOME} ; tar cBf - gem/skeleton | (cd ${INST_DIR_TARGET}/etc ; tar xBf - ) 2>/dev/null
@#-${INSTALL} ${GRASS_HOME}/gem/gem6 ${INST_DIR_TARGET} 2>/dev/null
Modified: grass/trunk/macosx/app/Makefile
===================================================================
--- grass/trunk/macosx/app/Makefile 2009-12-22 02:58:15 UTC (rev 40104)
+++ grass/trunk/macosx/app/Makefile 2009-12-22 03:30:37 UTC (rev 40105)
@@ -37,6 +37,7 @@
FILES = \
$(APPDIR)/MacOS/etc/build_html_user_index.sh \
$(APPDIR)/MacOS/etc/build_gui_user_menu.sh \
+ $(APPDIR)/MacOS/bin/python \
$(APPDIR)/Resources/app.icns \
$(APPDIR)/Info.plist \
$(APPDIR)/PkgInfo \
@@ -50,7 +51,7 @@
macosxapp:
-$(MAKE_DIR_CMD) $(OBJDIR)
-$(MAKE_DIR_CMD) $(APPDIR)/Resources/Scripts
- -$(MAKE_DIR_CMD) $(APPDIR)/MacOS/scripts
+ -$(MAKE_DIR_CMD) $(APPDIR)/MacOS/bin
-$(MAKE_DIR_CMD) $(APPDIR)/MacOS/etc
-$(MAKE_DIR_CMD) $(APPDIR)/Resources/English.lproj/MainMenu.nib
$(MAKE) $(FILES)
@@ -76,6 +77,9 @@
$(APPDIR)/MacOS/etc/%.sh: %.sh
$(INSTALL) $< $@
+$(APPDIR)/MacOS/bin/python: python_wrapper
+ $(INSTALL) $< $@
+
$(OBJDIR)/main.o: main.m
$(MAKE_DIR_CMD) $(OBJDIR)
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(EXTRA_INC) -o $(OBJDIR)/main.o -c main.m
Modified: grass/trunk/macosx/app/grass.sh.in
===================================================================
--- grass/trunk/macosx/app/grass.sh.in 2009-12-22 02:58:15 UTC (rev 40104)
+++ grass/trunk/macosx/app/grass.sh.in 2009-12-22 03:30:37 UTC (rev 40105)
@@ -142,8 +142,10 @@
GRASS_WXBUNDLED=
export GRASS_WXBUNDLED
pyexe="pythonw"
+GRASS_PYTHONWX="$pyexe"
pyver_want="@PYVER@"
-wx64bit="@WX64BIT@"
+GRASS_WX64BIT="@WX64BIT@"
+export GRASS_WX64BIT
# make sure python version used matches what wxpython wants
py=""
# did user set GRASS_PYTHON already? check it (must have pythonw)
@@ -190,23 +192,15 @@
if [ "$py" ] ; then
echo "$pyver found."
- GRASS_PYTHON="$py"
- # can't run python 64bit if wx not 64bit, assume OSX 10.6+ 64bit
- if [ $(($SYSVER)) -gt 9 ] && [ "$wx64bit" = "0" ] ; then
- case $SYSARCH$wx64bit in
- powerpc0) pyarch="ppc" ;;
- i3860) pyarch="i386" ;;
- *) pyarch="" ;;
- esac
- # make copy of pythonw 32bit because g.gui can't spawn multi-arg prog
- ditto -arch $pyarch "$py" "$GISBASE_USER/Modules/bin/pythonw"
- GRASS_PYTHON="pythonw"
- fi
- export GRASS_PYTHON
+ GRASS_PYTHONWX="$py"
else
echo "Warning: No Python $pyver_want found, needed by wxPython."
echo " The wxPython GUI may not work properly."
fi
+export GRASS_PYTHONWX
+# we will execute python scripts from the python wrapper script
+GRASS_PYTHON="python"
+export GRASS_PYTHON
# if grassrc has text startup, switch back to Terminal (gotta duplicate some init.sh stuff)
# only applies to Tiger - Leopard X11 opens automatically as needed
Added: grass/trunk/macosx/app/python_wrapper
===================================================================
--- grass/trunk/macosx/app/python_wrapper (rev 0)
+++ grass/trunk/macosx/app/python_wrapper 2009-12-22 03:30:37 UTC (rev 40105)
@@ -0,0 +1,45 @@
+#! /bin/sh
+#############################################################################
+#
+# MODULE: python wrapper
+# AUTHOR(S): William Kyngesburye - kyngchaos at kyngchaos.com
+# PURPOSE: handle arch options on OSX for running python.
+# COPYRIGHT: (C) 2000-2008 by the GRASS Development Team
+#
+# This program is free software under the GNU General Public
+# License (>=v2). Read the file COPYING that comes with GRASS
+# for details.
+#
+#############################################################################
+
+# wxpython-based scripts must be started from pythonw. And depending on the
+# installed wxpython, it may only be available in 32bits, while python may
+# at the same time run 64bit by default. Newer systems may also reexec python
+# as pythonw automatically as needed, except they don't respond to the arch
+# command (and that's an Apple-only thing, and only when /usr/bin/python is
+# used, yet /usr/bin/pythonw2.6 DOES respond to arch). The most universal
+# and reliable method is probably to not depend on Apple's customizations and
+# execute pythonw directly, 32bit if necessary.
+
+if [ -z "$GISBASE" ] ; then
+ echo "You must be in GRASS GIS to run this program." >&2
+ exit 1
+fi
+
+SYSARCH=`uname -p`
+SYSVER=`uname -r | cut -d . -f 1`
+
+if [ ! "$GRASS_PYTHONWX" ] ; then
+ GRASS_PYTHONWX="pythonw"
+fi
+# can't run python 64bit if wx not 64bit, assume OSX 10.5+ possible 64bit
+if [ $(($SYSVER)) -gt 5 ] && [ "$GRASS_WX64BIT" = "0" ] ; then
+ case $SYSARCH in
+ powerpc) pyarch="-ppc" ;;
+ i386) pyarch="-i386" ;;
+ *) pyarch="" ;;
+ esac
+ exec /usr/bin/arch $pyarch "$GRASS_PYTHONWX" "$@"
+else
+ exec "$GRASS_PYTHONWX" "$@"
+fi
Property changes on: grass/trunk/macosx/app/python_wrapper
___________________________________________________________________
Added: svn:executable
+ *
More information about the grass-commit
mailing list