You could do the following, since OS X has a UNIX foundation. (I'm assuming it also has some standard utilities like uudecode
and unzip
.);
- Create a zipfile for your package with the standard Python packaging tools, like distutils.
- Use
uuencode file.zip file.zip >uu.txt
to convert this zip-file to text.
- Create a shell-script.
- Put the text generated by
uuencode
as a here-document in that shell-script, that is fed to uudecode
, to recreate the zipfile. This should be the second command in the shell-script. The first commands should check for neccesary utilities.
- Use whatever Python setup tools you have to install the zipfile.
- Do any post-install stuff you want.
- Remove the zip-file.
To install the program, run the shell-script. On UNIX, this script should be run as root. Don't know how OS X handles that, though. Below is an example (the included zipfile contains two files with only random noise) ;
#!/bin/sh
# Install script for foo
# Check for special programs that are used in this script.
PROGS="uudecode unzip python"
for P in $PROGS; do
which $P >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$(basename $0): The program \"$P\" cannot be found."
exit 1
fi
done
uudecode <<"EOF"
begin 644 test.zip
M4$L#!`H``````(<!K$`````````````````$`!P`9F]O+U54"0`#OHZM3ZB.
MK4]U>`L``03I`P``!.D#``!02P,$"@``````A`&L0$EXM>H``@````(```<`
M'`!F;V\O8F%R550)``.XCJU/N(ZM3W5X"P`!!.D#```$Z0,``)DCNBVSM81_
MA%IQ!+LKC\;\19[/E]F!`J2J*2:9B_8#MC^KM*]]9P1]?1Y1@1+/H%Q"'2J'
M,;$7:C9E+WC]%M(BAUFN]4D\$%F63!^CA8O>'0C(-!YD?$\GQ[;M:?@>=A/[
M61XK<A/]\.?!0$QX<5]T\9<ZP$;_?PRMV-3O(NK)/<MTI,!RYA&OWRK6<8%4
M_1!T/+-'7H^V#C[AK)+U?T>UCU."G]D(+JU[8Z#1EI89@'^10B:8.2$$9Q*@
MY:L4MK'^TVF)A5)9\%"/FF+1T@;]8\,I)$CCHHF#E&,D.GVM1=2N];4J?6WR
M0+YH]DXZ"UQ$GVA^F(`5L![=/<ROX]9RQCRWJ=?+G4Y>56[H=8:!:GTA_V;V
M2V$%U5([0D;T19H]P7+^448+^&M3;[/VJDEJ-SU=Q8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P<]0!?P\$RFUC/S:Y_Y\0*:\+$U+JEM%"
M9E!+`0(>`PH``````(<!K$`````````````````$`!@`````````$`#M00``
M``!F;V\O550%``.^CJU/=7@+``$$Z0,```3I`P``4$L!`AX#"@``````A`&L
M0$EXM>H``@````(```<`&````````````*2!/@```&9O;R]B87)55`4``[B.
MK4]U>`L``03I`P``!.D#``!02P$"'@,*``````"&`:Q`Q2@K\@`"`````@``
M!P`8````````````I(%_`@``9F]O+V)A>E54!0`#O(ZM3W5X"P`!!.D#```$
:Z0,``%!+!08``````P`#`.0```#`!```````
`
end
EOF
# Unpack your zipfile
unzip test.zip
# Go into the created subdirectory and install
cd foo
python setup.py install
# whatever post-install stuff you want goes here...
cd ..
rm -rf foo test.zip