#! /bin/sh -e
#
# elisp install file for Debian python-elisp package
# /usr/lib/emacsen-common/packages/install/python-elisp
#
# Based on Rob Browning's sample script,
# adopted for python-mode.el by Gregor Hoffleit <flight@debian.org>.
#

PACKAGE=python-elisp

FLAVOR=$1
echo install/${PACKAGE}: Handling install of emacsen flavor ${FLAVOR}

byte_compile_options="-batch -f batch-byte-compile"
el_files="python-mode.el" 
el_dir=/usr/share/emacs/site-lisp/${PACKAGE}/
elc_dir=/usr/share/${FLAVOR}/site-lisp/${PACKAGE}/
el_path_list=`echo ${el_files} | perl -pe "s|^|${el_dir}|o"`
elc_path_list=`echo ${el_files} | perl -pe "s|^|${elc_dir}|o"`

if [ ${FLAVOR} != emacs -a ${FLAVOR} != emacs19 ]
then
    echo install/${PACKAGE}: byte-compiling for ${FLAVOR}

    # Copy the temp .el files
    test -d ${elc_dir} || mkdir ${elc_dir}
    cp ${el_path_list} ${elc_dir}

    # Byte compile them
    ${FLAVOR} ${byte_compile_options} ${elc_path_list}

    # remove the redundant .el files
    # presumes that any .el files in the <flavor> dir are trash.
    rm ${elc_dir}/*.el
fi

exit 0
