3 # Create a MachoPython package from the currently installed verison 
   4 # and put it on a disk image 
  11 progDir
="`dirname \"$0\"`" 
  13 defDstPath
="/projects/wx/wxPython/dist" 
  19 sitePkgDir
="$pkgRoot/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER/site-packages" 
  21 pythonExec
="python$PYVER" 
  22 makePkgExec
="./makepkg" 
  23 makeDmgExec
="./makedmg" 
  27     echo `basename $0`: ERROR
: $
* 1>&2 
  28     echo usage
: `basename $0` '[-d dir]' 1>&2 
  33     # probably not quite correct, but seems to work 
  34     echo "$1" | sed -e 's/\([^a-zA-z0-9.,--;_/]\)/\\\1/g' 
  39     echo "---------------------------------------------" 
  56         -d) shift; dstPath
="$1";; 
  57         -*) usage 
"bad argument $1";; 
  64 #----------------------------------- 
  65 msg check and prepare build directories
 
  67 if ! test "$dstPath"; then 
  70 if ! test -d "$dstPath"; then 
  71     msgdo 
mkdir -p -m 775 "$dstPath" 
  72     msgdo chown 
${user}:staff 
"$dstPath" 
  76 if test -e "$dstPath/$temp"; then 
  77     msgdo 
rm -rf "$dstPath/$temp" 
  79 msgdo 
mkdir -m 775 "$dstPath/$temp" 
  81 if test -e "$dstPath/$temp/$pkgRoot"; then 
  82     msgdo 
rm -rf "$dstPath/$temp/$pkgRoot" 
  84 msgdo 
mkdir -m 1775 "$dstPath/$temp/$pkgRoot" 
  85 msgdo chown root
:admin 
"$dstPath/$temp/$pkgRoot" 
  87 if test -e "$dstPath/$temp/$dmgRoot"; then 
  88     msgdo 
rm -rf "$dstPath/$temp/$dmgRoot" 
  90 msgdo 
mkdir -p -m 775 "$dstPath/$temp/$dmgRoot" 
  91 msgdo chown 
$user:staff 
"$dstPath/$temp/$dmgRoot" 
  93 #----------------------------------- 
  94 msg Copying files to package build dir
 
  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 
 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 .
 
 109 exec /Applications/Python.app/Contents/MacOS/python \$@ 
 115 #----------------------------------- 
 116 msg Removing locally installed extension modules
 
 118 msgdo 
cd $dstPath/$temp/$sitePkgDir 
 120     if [ $f != README 
]; then 
 124 for f 
in Numeric numarray
; do 
 125     rm -r $dstPath/$temp/$pkgRoot/Library
/Frameworks
/Python.framework
/Versions
/$PYVER/include
/python
$PYVER/$f 
 129 #----------------------------------- 
 130 msg Adjusting ownership and permission
 
 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" 
 136 msgdo chown 
-R root
:wheel 
"$dstPath/$temp/$pkgRoot/usr" 
 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
 
 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
 
 149 #----------------------------------- 
 150 msg making disk image
 
 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" 
 159 #----------------------------------- 
 161 msgdo 
rm $progDir/$pkgName-$version.info
 
 162 msgdo 
rm -rf "$dstPath/$temp"