# Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header$ # Note that this ebuild also installs python-dsv because it looks like # it won't be added to portage. See # http://bugs.gentoo.org/show_bug.cgi?id=57323. inherit distutils DESCRIPTION="This program allows you to view and manipulate data on LG VX4400/VX6000 and many Sanyo Sprint mobile phones" HOMEPAGE="http://www.bitpim.org/" SRC_URI="http://www.bitpim.org/${PN}-${PV}.tar.bz2 mirror://sourceforge/python-dsv/DSV-1.4.0.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~x86" IUSE="crypt usb evo" # Exact dep for wxpython ok since they've moved onto 2.5.x DEPEND=">=dev-lang/python-2.3 >=dev-python/wxpython-2.6.2.1 >=dev-python/apsw-3 dev-python/pyserial crypt? ( dev-python/paramiko ) usb? ( >=dev-lang/swig-1.3.19 dev-libs/libusb sys-devel/gcc )" src_unpack() { unpack ${A} epatch ${FILESDIR}/get_main_dir_fix.patch } src_compile() { # USB stuff if use usb; then cd ${S}/src/native/usb # FIXME: sed -i "s/python2.3/${python}/" build.sh sh ./build.sh fi # strings cd ${S}/src/native/strings ${python} setup.py build "$@" || die "compilation of strings failed" # bmp2avi cd ${S}/src/native/av/bmp2avi PLATFORM=linux make # Everything else is pure Python # DSV cd ${WORKDIR}/DSV-1.4.0 ${python} setup.py build "$@" || die "compilation of DSV failed" } # To copy a whole directory; where is this in Portage lib? docpr() { [ ! -d $D/$INSDESTTREE ] && install -d $D/$INSDESTTREE for dir in $@; do cp -rv $dir ${D}/$INSDESTTREE # delete CVS cruft cruft=$(find $dir -name CVS -type d) rm -rfv $cruft done } # Default source install is for static release, so we do # everything ourselves src_install() { # Enter source dir cd ${S} # Install files into right place # # BitPim is a self-contained app, so jamming it into # Python's site-packages might not be worthwhile. We'll # Put it in its own home, and add the PYTHONPATH in the # wrapper executables below. distutils_python_version export RLOC=/usr/lib/BitPim-${PV} # export for use later # Main Python source insinto $RLOC doins src/*.py docpr ./resources ./help # Phone specifics insinto $RLOC/phones doins src/phones/*.py # Native products insinto $RLOC/native doins src/native/*.py docpr src/native/qtopiadesktop docpr src/native/outlook docpr src/native/egroupware use evo && docpr src/native/evolution # strings cd ${S}/src/native/strings ${python} setup.py install --root=${D} --no-compile "$@" || die "install of strings failed" cd - insinto $RLOC/native/strings doins src/native/strings/__init__.py src/native/strings/jarowpy.py # usb if use usb; then insinto ${RLOC}/native/usb doins src/native/usb/*.py doins src/native/usb/*.so fi # Helpers insinto /usr/lib/${PF}/helpers doins ${S}/src/native/av/bmp2avi/bmp2avi.lbin doins ${S}/helpers/*.lbin # Bitfling if use crypt; then FLINGDIR="${RLOC}/bitfling" insinto $FLINGDIR cd ${S}/src/bitfling doins *.py # "paramiko" is now external, but code still wants "paramiko_bp" # necessitating an ugly hack # First get site-packages SPATH=`python -c "import sys, re; paths=sys.path; spath=(filter(lambda a: re.search(\"site-packages$\", a), paths)); print spath.pop()"` dosym $SPATH/paramiko ${RLOC}/bitfling/paramiko_bp cd ${S} fi # NOTE: docs are old, so skipping them # Creating scripts echo "#!/bin/sh" >> ${T}/bitpim echo "export PYTHONPATH=\"$RLOC:$PYTHONPATH\"" >> ${T}/bitpim echo "exec python ${RLOC}/bp.py bitpim" >> ${T}/bitpim dobin ${T}/bitpim if use crypt; then echo "#!/bin/sh" >> ${T}/bitfling echo "export PYTHONPATH=\"$RLOC:$PYTHONPATH\"" >> ${T}/bitpim echo "exec python ${RLOC}/bp.py bitfling" >> ${T}/bitfling dobin ${T}/bitfling fi # Install DSV cd ${WORKDIR}/DSV-1.4.0 ${python} setup.py install --root=${D} --no-compile "$@" || die } pkg_postinst() { # Optimize in installed directory python_mod_optimize ${ROOT}/${RLOC} # Helpful message re. support einfo "For support information please visit http://bitpim.org/" }