[GRASS-SVN] r37988 - in grass/branches/releasebranch_6_4/macosx: . app pkg/resources

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jun 20 00:30:29 EDT 2009


Author: kyngchaos
Date: 2009-06-20 00:30:29 -0400 (Sat, 20 Jun 2009)
New Revision: 37988

Modified:
   grass/branches/releasebranch_6_4/macosx/Makefile
   grass/branches/releasebranch_6_4/macosx/app/Makefile
   grass/branches/releasebranch_6_4/macosx/app/grass.sh.in
   grass/branches/releasebranch_6_4/macosx/pkg/resources/postflight.in
Log:
precompile python scripts for bindist package install as user may not have perms at runtime (from dev6 r37987)

Modified: grass/branches/releasebranch_6_4/macosx/Makefile
===================================================================
--- grass/branches/releasebranch_6_4/macosx/Makefile	2009-06-20 04:25:16 UTC (rev 37987)
+++ grass/branches/releasebranch_6_4/macosx/Makefile	2009-06-20 04:30:29 UTC (rev 37988)
@@ -12,6 +12,8 @@
 MAKE_DIR_CMD = mkdir -p -m 755
 LN = /bin/ln -sf
 LN_DIR = /bin/ln -sfh
+# get python version - use python in path, should be config'd python
+PYVER = `python -V 2>&1 | cut -d \  -f 2 | cut -d . -f 1,2`
 
 # packagemaker location, options and behaviour changed in xcode 3
 ifeq ($(findstring darwin9,$(ARCH)),darwin9)
@@ -97,7 +99,7 @@
 	${MAKE} bundle-macosx
 	@# pkg resources
 	${MAKE_DIR_CMD} dist/resources
-	-sed -e "s#@INST_DIR@#${INST_DIR}#g" -e "s#@MACOSX_SUPPDIR@#${MACOSX_SUPPDIR}#g" -e "s#@GRASS_VER@#${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}#g" pkg/resources/postflight.in > dist/resources/postflight
+	-sed -e "s#@INST_DIR@#${INST_DIR}#g" -e "s#@MACOSX_SUPPDIR@#${MACOSX_SUPPDIR}#g" -e "s#@GRASS_VER@#${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}#g" -e "s#@PYVER@#${PYVER}#g" pkg/resources/postflight.in > dist/resources/postflight
 	-chmod a+rx dist/resources/postflight
 	-sed -e "s#@GRASS_VER@#${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}#g" pkg/resources/Description.plist.in > dist/Description.plist
 	-sed -e "s#@GRASS_VERSION_MAJOR@#${GRASS_VERSION_MAJOR}#g" -e "s#@GRASS_VERSION_MINOR@#${GRASS_VERSION_MINOR}#g" -e "s#@GRASS_VERSION_RELEASE@#${GRASS_VERSION_RELEASE}#g" -e "s#@VER_MINOR_REL@#${VER_MINOR_REL}#g" -e "s#@VER_DATE@#${VER_DATE}#g" -e "s#@PKG_INST_DIR@#${PKG_INST_DIR}#g" pkg/resources/Info.plist.in > dist/Info.plist

Modified: grass/branches/releasebranch_6_4/macosx/app/Makefile
===================================================================
--- grass/branches/releasebranch_6_4/macosx/app/Makefile	2009-06-20 04:25:16 UTC (rev 37987)
+++ grass/branches/releasebranch_6_4/macosx/app/Makefile	2009-06-20 04:30:29 UTC (rev 37988)
@@ -27,6 +27,8 @@
 ifndef PROJ_BIN
 PROJ_BIN = `echo "${NAD2BIN}" | sed -e "s,.=,," -e "s,/nad2bin,,"`
 endif
+# get python version - use python in path, should be config'd python
+PYVER = `python -V 2>&1 | cut -d \  -f 2 | cut -d . -f 1,2`
 
 default: macosxapp
 
@@ -68,6 +70,7 @@
 	sed -e "s, at GDAL_BIN_PATH@,$(GDAL_BIN):," \
 	-e "s, at PROJ_BIN_PATH@,$(PROJ_BIN):," \
 	-e "s, at X11@,$(USE_X11),g" \
+	-e "s, at PYVER@,$(PYVER),g" \
 	grass.sh.in > $(OBJDIR)/grass.sh
 
 clean:

Modified: grass/branches/releasebranch_6_4/macosx/app/grass.sh.in
===================================================================
--- grass/branches/releasebranch_6_4/macosx/app/grass.sh.in	2009-06-20 04:25:16 UTC (rev 37987)
+++ grass/branches/releasebranch_6_4/macosx/app/grass.sh.in	2009-06-20 04:30:29 UTC (rev 37988)
@@ -181,7 +181,7 @@
 # change GRASS_WXBUNDLED and pyver_want here from bundle.make, or manually
 GRASS_WXBUNDLED=
 export GRASS_WXBUNDLED
-pyver_want="2.5"
+pyver_want="@PYVER@"
 if [ -d "$GISBASE/etc/wxpython" ] && [ "$GRASS_WXBUNDLED" = "1" ] ; then
 # make sure python version used matches what wxpython wants
 py=""

Modified: grass/branches/releasebranch_6_4/macosx/pkg/resources/postflight.in
===================================================================
--- grass/branches/releasebranch_6_4/macosx/pkg/resources/postflight.in	2009-06-20 04:25:16 UTC (rev 37987)
+++ grass/branches/releasebranch_6_4/macosx/pkg/resources/postflight.in	2009-06-20 04:30:29 UTC (rev 37988)
@@ -22,6 +22,42 @@
 
 cp -Rf "$PACKAGE_PATH/Contents/Resources/modbuild" "$MACOSX_SUPPDIR"
 
+# cache python - use python version GRASS was compiled for
+
+pyver_want="@PYVER@"
+py=`type -p python`
+if [ "$py" ] ; then
+	pyver=`python -V 2>&1 | grep " $pyver_want"`
+	if [ ! "$pyver" ] ; then
+		py=""
+	else
+		pyconf="python-config"
+	fi
+fi
+# try standard framework
+if [ ! "$py" ] ; then
+	py="/Library/Frameworks/Python.framework/Versions/$pyver_want/bin/python"
+	if [ ! -x "$py" ] ; then
+		py=""
+	else
+		pyconf="/Library/Frameworks/Python.framework/Versions/$pyver_want/bin/python-config"
+	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=""
+	else
+		pyconf="/usr/bin/python-config"
+	fi
+fi
+if [ "$py" ] ; then
+	pycompile=`$pyconf --prefix`/lib/python$pyver_want/compileall.py
+	$py $pycompile "$INST_DIR"
+fi
+
 # readme
 # needs a better home?
 



More information about the grass-commit mailing list