]> git.saurik.com Git - wxWidgets.git/blame - wxPython/distrib/mac/_buildPython
Scripts to make a installer package in a disk image for wxPython and
[wxWidgets.git] / wxPython / distrib / mac / _buildPython
CommitLineData
8721cada
RD
1#!/bin/sh -e
2#
3# Create a MachoPython package from the currently installed verison
4# and put it on a disk image
5#
6
7
8PYVER=2.2
9
10curDir=`pwd`
11progDir="`dirname \"$0\"`"
12
13defDstPath="/projects/wx/wxPython/dist"
14
15pkgName="MachoPython"
16version=2.2.1-2
17dmgRoot="dmg-root"
18pkgRoot="pkg-root"
19sitePkgDir="$pkgRoot/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/site-packages"
20
21pythonExec="python$PYVER"
22makePkgExec="./makepkg"
23makeDmgExec="./makedmg"
24
25
26usage() {
27 echo `basename $0`: ERROR: $* 1>&2
28 echo usage: `basename $0` '[-d dir]' 1>&2
29 exit 1
30}
31
32quotemeta() {
33 # probably not quite correct, but seems to work
34 echo "$1" | sed -e 's/\([^a-zA-z0-9.,--;_/]\)/\\\1/g'
35}
36
37msg()
38{
39 echo "---------------------------------------------"
40 echo $@
41}
42
43msgdo() {
44 echo "--> " $@
45 $@
46}
47
48
49user=$1
50shift
51
52dstPath=
53
54while :; do
55 case "$1" in
56 -d) shift; dstPath="$1";;
57 -*) usage "bad argument $1";;
58 *) break;;
59 esac
60 shift
61done
62
63
64#-----------------------------------
65msg check and prepare build directories
66
67if ! test "$dstPath"; then
68 dstPath=$defDstPath
69fi
70if ! test -d "$dstPath"; then
71 msgdo mkdir -p -m 775 "$dstPath"
72 msgdo chown ${user}:staff "$dstPath"
73fi
74
75temp="tmp$$"
76if test -e "$dstPath/$temp"; then
77 msgdo rm -rf "$dstPath/$temp"
78fi
79msgdo mkdir -m 775 "$dstPath/$temp"
80
81if test -e "$dstPath/$temp/$pkgRoot"; then
82 msgdo rm -rf "$dstPath/$temp/$pkgRoot"
83fi
84msgdo mkdir -m 1775 "$dstPath/$temp/$pkgRoot"
85msgdo chown root:admin "$dstPath/$temp/$pkgRoot"
86
87if test -e "$dstPath/$temp/$dmgRoot"; then
88 msgdo rm -rf "$dstPath/$temp/$dmgRoot"
89fi
90msgdo mkdir -p -m 775 "$dstPath/$temp/$dmgRoot"
91msgdo chown $user:staff "$dstPath/$temp/$dmgRoot"
92
93#-----------------------------------
94msg Copying files to package build dir
95
96for d in Applications/Python.app Library/Frameworks/Python.framework; do
97 msgdo mkdir -p -m 755 $dstPath/$temp/$pkgRoot/$d
98 msgdo cp -pR /$d/* $dstPath/$temp/$pkgRoot/$d
99done
100
101msgdo mkdir -p -m 755 $dstPath/$temp/$pkgRoot/usr/local/bin
102msgdo cd $dstPath/$temp/$pkgRoot/usr/local/bin
103for f in pydoc python python$PYVER; do
104 msgdo ln -s ../../../Library/Frameworks/Python.framework/Versions/Current/bin/$f .
105done
106
107cat > pythonw <<EOF
108#!/bin/sh
109exec /Applicaitons/Python.app/Contents/MacOS/python $@
110EOF
111chmod +x pythonw
112cd $curDir
113
114
115#-----------------------------------
116msg Removing locally installed extension modules
117
118msgdo cd $dstPath/$temp/$sitePkgDir
119for f in *; do
120 if [ $f != README ]; then
121 msgdo rm -r $f
122 fi
123done
124for f in Numeric numarray; do
125 rm -r $dstPath/$temp/$pkgRoot/Library/Frameworks/Python.framework/Versions/$PYVER/include/python$PYVER/$f
126done
127cd $curDir
128
129#-----------------------------------
130msg making installer package
131msgdo cp -pR "$progDir/resourcesPython" "$dstPath/$temp/"
132msgdo mv "$dstPath/$temp/resourcesPython" "$dstPath/$temp/resources"
133msgdo cp $progDir/$pkgName.info $progDir/$pkgName-$version.info
134msgdo cd "$progDir"
135msgdo "$makePkgExec" $dstPath/$temp/$pkgRoot $pkgName-$version.info -d $dstPath/$temp/$dmgRoot -r $dstPath/$temp/resources
136msgdo chown -R ${user}:staff $dstPath/$temp/$dmgRoot/$pkgName-$version.pkg
137cd $curDir
138
139
140#-----------------------------------
141msg making disk image
142msgdo cd "$progDir"
143msgdo "$makeDmgExec" $dstPath/$temp/$dmgRoot $dstPath/$temp $pkgName-$version
144dmgName="$pkgName-$version"
145msgdo mv "$dstPath/$temp/$pkgName-$version.dmg" "$dstPath/$dmgName.dmg"
146msgdo chown ${user}:staff "$dstPath/$dmgName.dmg"
147cd $curDir
148
149
150#-----------------------------------
151msg cleaning up
152msgdo rm $progDir/$pkgName-$version.info
153msgdo rm -rf "$dstPath/$temp"