Scripts to make a installer package in a disk image for wxPython and
for Python too. It's a strange mixture of sh, csh and perl, but it works. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15584 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
153
wxPython/distrib/mac/_buildPython
Executable file
153
wxPython/distrib/mac/_buildPython
Executable file
@@ -0,0 +1,153 @@
|
||||
#!/bin/sh -e
|
||||
#
|
||||
# Create a MachoPython package from the currently installed verison
|
||||
# and put it on a disk image
|
||||
#
|
||||
|
||||
|
||||
PYVER=2.2
|
||||
|
||||
curDir=`pwd`
|
||||
progDir="`dirname \"$0\"`"
|
||||
|
||||
defDstPath="/projects/wx/wxPython/dist"
|
||||
|
||||
pkgName="MachoPython"
|
||||
version=2.2.1-2
|
||||
dmgRoot="dmg-root"
|
||||
pkgRoot="pkg-root"
|
||||
sitePkgDir="$pkgRoot/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/site-packages"
|
||||
|
||||
pythonExec="python$PYVER"
|
||||
makePkgExec="./makepkg"
|
||||
makeDmgExec="./makedmg"
|
||||
|
||||
|
||||
usage() {
|
||||
echo `basename $0`: ERROR: $* 1>&2
|
||||
echo usage: `basename $0` '[-d dir]' 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
quotemeta() {
|
||||
# probably not quite correct, but seems to work
|
||||
echo "$1" | sed -e 's/\([^a-zA-z0-9.,--;_/]\)/\\\1/g'
|
||||
}
|
||||
|
||||
msg()
|
||||
{
|
||||
echo "---------------------------------------------"
|
||||
echo $@
|
||||
}
|
||||
|
||||
msgdo() {
|
||||
echo "--> " $@
|
||||
$@
|
||||
}
|
||||
|
||||
|
||||
user=$1
|
||||
shift
|
||||
|
||||
dstPath=
|
||||
|
||||
while :; do
|
||||
case "$1" in
|
||||
-d) shift; dstPath="$1";;
|
||||
-*) usage "bad argument $1";;
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
#-----------------------------------
|
||||
msg check and prepare build directories
|
||||
|
||||
if ! test "$dstPath"; then
|
||||
dstPath=$defDstPath
|
||||
fi
|
||||
if ! test -d "$dstPath"; then
|
||||
msgdo mkdir -p -m 775 "$dstPath"
|
||||
msgdo chown ${user}:staff "$dstPath"
|
||||
fi
|
||||
|
||||
temp="tmp$$"
|
||||
if test -e "$dstPath/$temp"; then
|
||||
msgdo rm -rf "$dstPath/$temp"
|
||||
fi
|
||||
msgdo mkdir -m 775 "$dstPath/$temp"
|
||||
|
||||
if test -e "$dstPath/$temp/$pkgRoot"; then
|
||||
msgdo rm -rf "$dstPath/$temp/$pkgRoot"
|
||||
fi
|
||||
msgdo mkdir -m 1775 "$dstPath/$temp/$pkgRoot"
|
||||
msgdo chown root:admin "$dstPath/$temp/$pkgRoot"
|
||||
|
||||
if test -e "$dstPath/$temp/$dmgRoot"; then
|
||||
msgdo rm -rf "$dstPath/$temp/$dmgRoot"
|
||||
fi
|
||||
msgdo mkdir -p -m 775 "$dstPath/$temp/$dmgRoot"
|
||||
msgdo chown $user:staff "$dstPath/$temp/$dmgRoot"
|
||||
|
||||
#-----------------------------------
|
||||
msg Copying files to package build dir
|
||||
|
||||
for d in Applications/Python.app Library/Frameworks/Python.framework; do
|
||||
msgdo mkdir -p -m 755 $dstPath/$temp/$pkgRoot/$d
|
||||
msgdo cp -pR /$d/* $dstPath/$temp/$pkgRoot/$d
|
||||
done
|
||||
|
||||
msgdo mkdir -p -m 755 $dstPath/$temp/$pkgRoot/usr/local/bin
|
||||
msgdo cd $dstPath/$temp/$pkgRoot/usr/local/bin
|
||||
for f in pydoc python python$PYVER; do
|
||||
msgdo ln -s ../../../Library/Frameworks/Python.framework/Versions/Current/bin/$f .
|
||||
done
|
||||
|
||||
cat > pythonw <<EOF
|
||||
#!/bin/sh
|
||||
exec /Applicaitons/Python.app/Contents/MacOS/python $@
|
||||
EOF
|
||||
chmod +x pythonw
|
||||
cd $curDir
|
||||
|
||||
|
||||
#-----------------------------------
|
||||
msg Removing locally installed extension modules
|
||||
|
||||
msgdo cd $dstPath/$temp/$sitePkgDir
|
||||
for f in *; do
|
||||
if [ $f != README ]; then
|
||||
msgdo rm -r $f
|
||||
fi
|
||||
done
|
||||
for f in Numeric numarray; do
|
||||
rm -r $dstPath/$temp/$pkgRoot/Library/Frameworks/Python.framework/Versions/$PYVER/include/python$PYVER/$f
|
||||
done
|
||||
cd $curDir
|
||||
|
||||
#-----------------------------------
|
||||
msg making installer package
|
||||
msgdo cp -pR "$progDir/resourcesPython" "$dstPath/$temp/"
|
||||
msgdo mv "$dstPath/$temp/resourcesPython" "$dstPath/$temp/resources"
|
||||
msgdo cp $progDir/$pkgName.info $progDir/$pkgName-$version.info
|
||||
msgdo cd "$progDir"
|
||||
msgdo "$makePkgExec" $dstPath/$temp/$pkgRoot $pkgName-$version.info -d $dstPath/$temp/$dmgRoot -r $dstPath/$temp/resources
|
||||
msgdo chown -R ${user}:staff $dstPath/$temp/$dmgRoot/$pkgName-$version.pkg
|
||||
cd $curDir
|
||||
|
||||
|
||||
#-----------------------------------
|
||||
msg making disk image
|
||||
msgdo cd "$progDir"
|
||||
msgdo "$makeDmgExec" $dstPath/$temp/$dmgRoot $dstPath/$temp $pkgName-$version
|
||||
dmgName="$pkgName-$version"
|
||||
msgdo mv "$dstPath/$temp/$pkgName-$version.dmg" "$dstPath/$dmgName.dmg"
|
||||
msgdo chown ${user}:staff "$dstPath/$dmgName.dmg"
|
||||
cd $curDir
|
||||
|
||||
|
||||
#-----------------------------------
|
||||
msg cleaning up
|
||||
msgdo rm $progDir/$pkgName-$version.info
|
||||
msgdo rm -rf "$dstPath/$temp"
|
Reference in New Issue
Block a user