Files
wxWidgets/wxPython/distrib/mac/MacPython/resources/postflight

49 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
#----------------------------------------------------------------------
# Create the unix tools and compile the .py files after Python has been
# installed.
#----------------------------------------------------------------------
PYVER=2.3
PKG=$1
DEST=$2
# if destination is / then use usr/local/bin, otherwise just bin
if [ "$DEST" = "/" ]; then
TOOLDIR=/usr/local/bin
else
TOOLDIR=$DEST/bin
fi
# Make some links to the python executable
if [ -e $TOOLDIR/python$PYVER]; then
rm $TOOLDIR/python$PYVER
fi
ln -fs $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/bin/python $TOOLDIR/python$PYVER
if [ -e $TOOLDIR/python]; then
rm $TOOLDIR/python
fi
ln -fs python$PYVER $TOOLDIR/python
# make the pythonw script
cat > $TOOLDIR/pythonw <<EOF
#!/bin/sh
exec "$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/Resources/Python.app/Contents/MacOS/python" "\$@"
EOF
chmod +x $TOOLDIR/pythonw
# Compile the .py files in the Python library to .pyc's and then .pyo's
$TOOLDIR/python -Wi -tt \
$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/compileall.py \
-x badsyntax $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER
$TOOLDIR/python -Wi -tt -O \
$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/compileall.py \
-x badsyntax $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER