#! /bin/bash # This is just a helper script to generatePythonCode to cover # the three or four cases we use all the time # usage: genPyCode [opts] [linux|win-debug|win-release|win-publish|install|release] [other libs] # -t adds libtoontown # -v adds libvrpn # -e adds libpandaegg # -n doesn't perform a squeeze base_dir=$(pwd) extra_genPyCode_libs="" fSqueeze="squeezeMe" optimizeFlag="" ppython=ppython ppythonOptimizeFlag="" while getopts tven flag; do case $flag in t) extra_genPyCode_libs="$extra_genPyCode_libs libtoontown" ;; v) extra_genPyCode_libs="$extra_genPyCode_libs libvrpn" ;; e) extra_genPyCode_libs="$extra_genPyCode_libs libpandaegg" ;; n) fSqueeze="" ;; esac done shift `expr $OPTIND - 1` buildType="$1" shift extra_genPyCode_libs="$extra_genPyCode_libs $*" if [ "$INSTALL_DIR" != "" ]; then install_dir="$INSTALL_DIR" elif [ "$PANDA_INSTALL" != "" ]; then install_dir="$PANDA_INSTALL" elif [ "$DIRECT" != "" ]; then install_dir="$DIRECT" else install_dir=./install fi pyDir=$DIRECT/lib/py extDir=$DIRECT/src/extensions pSqueezer=$DIRECT/src/showbase/pandaSqueezer.py if [ $(uname | grep CYGWIN) ]; then install_dir="$(cygpath -aw $install_dir)" pyDir="$(cygpath -w $pyDir)" extDir="$(cygpath -w $extDir)" pSqueezer="$(cygpath -w $pSqueezer)" fi if [ "$buildType" = "linux" ]; then cd $DIRECT/bin ppython -d generatePythonCode -v -d $pyDir -e $extDir -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit pSqueezer=$DIRECT/src/showbase/pandaSqueezer.py elif [ "$buildType" = "win-debug" ]; then cd $DIRECT/bin ppython -d generatePythonCode -v -d $pyDir -e $extDir -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit elif [ "$buildType" = "win-release" ]; then cd $DIRECT/bin ppython generatePythonCode -v -d $pyDir -e $extDir -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit elif [ "$buildType" = "win-publish" ]; then # no assertions, no comments, no docstrings cd $DIRECT/bin ppython -OO generatePythonCode -O -v -d $pyDir -e $extDir -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit optimizeFlag="-O" ppythonOptimizeFlag="-OO" elif [ "$buildType" = "install" ]; then # Use relative paths; as installed on a machine without ctattach etc. pyDir=$install_dir/lib/py ppython=$install_dir/bin/ppython $ppython -d $install_dir/bin/generatePythonCode -O -v -d $pyDir -e direct/src/extensions -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit elif [ "$buildType" = "release" ]; then # Use relative paths; as installed on a machine without ctattach etc. pyDir=$install_dir/lib/py ppython=$install_dir/bin/ppython $ppython $install_dir/bin/generatePythonCode -v -d $pyDir -e direct/src/extensions -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit pSqueezer="$(cygpath -w $base_dir/direct/src/showbase/pandaSqueezer.py)" || exit else echo "Invalid parameter: $buildType" exit 1 fi if [ "$fSqueeze" = "squeezeMe" ]; then echo SQUEEZING PandaModules cd $pyDir || exit rm -f PandaModules.py* || exit $ppython $ppythonOptimizeFlag $pSqueezer $optimizeFlag || exit else echo RENAMING PandaModulesUnsqueezed.py to PandaModules.py cd $pyDir || exit rm -f PandaModules.py* || exit echo # junk line needed to keep mv from failing mv PandaModulesUnsqueezed.py PandaModules.py || exit fi echo DONE