]>
Commit | Line | Data |
---|---|---|
1e4a197e RD |
1 | #!/bin/sh |
2 | #---------------------------------------------------------------------- | |
3 | # Create the unix tools and compile the .py files after Python has been | |
4 | # installed. | |
5 | #---------------------------------------------------------------------- | |
6 | ||
7 | PYVER=2.3 | |
8 | ||
9 | PKG=$1 | |
10 | DEST=$2 | |
11 | ||
12 | ||
13 | # if destination is / then use usr/local/bin, otherwise just bin | |
14 | if [ "$DEST" = "/" ]; then | |
15 | TOOLDIR=/usr/local/bin | |
16 | DEST= | |
17 | else | |
18 | TOOLDIR=$DEST/bin | |
19 | fi | |
20 | ||
21 | # Make sure the dir exists | |
22 | mkdir -p $TOOLDIR | |
23 | ||
24 | # Make some links to the python executable | |
25 | if [ -e $TOOLDIR/python$PYVER ]; then | |
26 | rm $TOOLDIR/python$PYVER | |
27 | fi | |
28 | ln -fs $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/bin/python $TOOLDIR/python$PYVER | |
29 | ||
30 | if [ -e $TOOLDIR/python ]; then | |
31 | rm $TOOLDIR/python | |
32 | fi | |
33 | ln -fs python$PYVER $TOOLDIR/python | |
34 | ||
35 | ||
36 | # make the pythonw script | |
37 | cat > $TOOLDIR/pythonw <<EOF | |
38 | #!/bin/sh | |
39 | exec "$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/Resources/Python.app/Contents/MacOS/python" "\$@" | |
40 | EOF | |
41 | chmod +x $TOOLDIR/pythonw | |
42 | ||
43 | ||
44 | # Compile the .py files in the Python library to .pyc's and then .pyo's | |
45 | $TOOLDIR/python -Wi -tt \ | |
46 | $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/compileall.py \ | |
47 | -x badsyntax -x site-packages $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER | |
48 | ||
49 | $TOOLDIR/python -Wi -tt -O \ | |
50 | $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/compileall.py \ | |
51 | -x badsyntax -x site-packages $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER | |
52 | ||
53 | ||
54 | # Make the site-packages and other dirs writable by the admin. | |
55 | for d in $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/site-packages \ | |
56 | $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/bin \ | |
57 | $DEST/Applications/MacPython-$PYVER; do | |
58 | chgrp -R admin $d | |
59 | chmod -R g+w $d | |
60 | done | |
61 | ||
62 | ||
63 | # The link in the app bundles needs updated. | |
64 | for app in BuildApplet IDLE PackageManager PythonIDE; do | |
65 | ln -s $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/Resources/Python.app/Contents/MacOS/python \ | |
66 | $DEST/Applications/MacPython-$PYVER/$app.app/Contents/MacOS | |
67 | done |