]> git.saurik.com Git - wxWidgets.git/blame - wxPython/distrib/mac/_buildPython
Fixed a quoting problem
[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"
ee5e8215 16version=2.2.1-3
8721cada
RD
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
ee5e8215 109exec /Applicaitons/Python.app/Contents/MacOS/python \$@
8721cada
RD
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
3ebfd150
RD
129#-----------------------------------
130msg Adjusting ownership and permission
131
132for d in Applications Library; do
133 msgdo chown -R root:admin "$dstPath/$temp/$pkgRoot/$d"
134 msgdo chmod -R g+w "$dstPath/$temp/$pkgRoot/$d"
135done
136msgdo chown -R root:wheel "$dstPath/$temp/$pkgRoot/usr"
137
8721cada
RD
138#-----------------------------------
139msg making installer package
140msgdo cp -pR "$progDir/resourcesPython" "$dstPath/$temp/"
141msgdo mv "$dstPath/$temp/resourcesPython" "$dstPath/$temp/resources"
142msgdo cp $progDir/$pkgName.info $progDir/$pkgName-$version.info
143msgdo cd "$progDir"
144msgdo "$makePkgExec" $dstPath/$temp/$pkgRoot $pkgName-$version.info -d $dstPath/$temp/$dmgRoot -r $dstPath/$temp/resources
145msgdo chown -R ${user}:staff $dstPath/$temp/$dmgRoot/$pkgName-$version.pkg
146cd $curDir
147
148
149#-----------------------------------
150msg making disk image
151msgdo cd "$progDir"
152msgdo "$makeDmgExec" $dstPath/$temp/$dmgRoot $dstPath/$temp $pkgName-$version
153dmgName="$pkgName-$version"
154msgdo mv "$dstPath/$temp/$pkgName-$version.dmg" "$dstPath/$dmgName.dmg"
155msgdo chown ${user}:staff "$dstPath/$dmgName.dmg"
156cd $curDir
157
158
159#-----------------------------------
160msg cleaning up
161msgdo rm $progDir/$pkgName-$version.info
162msgdo rm -rf "$dstPath/$temp"