blob: e7cb8f2c96533ddc43f4ba269e14b4fcd8fe42f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#!/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
DEST=
else
TOOLDIR=$DEST/bin
fi
# Make sure the dir exists
mkdir -p $TOOLDIR
# Make some links to the python executable
ln -fsh $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/bin/python $TOOLDIR/python$PYVER
ln -fsh python$PYVER $TOOLDIR/python
# make the pythonw script
rm -f $TOOLDIR/pythonw$PYVER
cat > $TOOLDIR/pythonw$PYVER <<EOF
#!/bin/sh
exec "$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/Resources/Python.app/Contents/MacOS/python" "\$@"
EOF
chmod +x $TOOLDIR/pythonw$PYVER
ln -fsh pythonw$PYVER $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 -x site-packages $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 -x site-packages $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER
$TOOLDIR/python -Wi -tt \
$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/compileall.py \
$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/Mac/Tools
$TOOLDIR/python -Wi -tt -O \
$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/compileall.py \
$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/Mac/Tools
# Make the site-packages and other dirs writable by the admin if destination is /
if [ "$DEST" = "/" ]; then
for d in $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/site-packages \
$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/bin \
$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/Resources/Python.app/Contents/Resources \
$DEST/Applications/MacPython-$PYVER; do
chgrp -R admin $d
chmod -R g+w $d
done
fi
# The link in the app bundles needs updated.
installed_python=$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/Resources/Python.app/Contents/MacOS/python
for app in BuildApplet IDLE PackageManager PythonIDE; do
ln -fsh $installed_python \
$DEST/Applications/MacPython-$PYVER/$app.app/Contents/MacOS
ed -s $DEST/Applications/MacPython-$PYVER/$app.app/Contents/MacOS/$app << xyzzy
1c
#!$installed_python
.
w
q
xyzzy
done
|