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