# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils distutils DESCRIPTION="Portato - a GUI for Portage written in Python." HOMEPAGE="http://portato.sourceforge.net" SRC_URI="mirror://sourceforge/portato/${P}.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~x86 ~amd64" IUSE="syntax etcproposals qt4 gtk" official_syntax=">=dev-python/gnome-python-desktop-2.16.0" inoffical_syntax="||( >=dev-python/pygtksourceview-2.16.0 >=dev-python/gnome-python-desktop-2.16.0 )" used_syntax=$official_syntax RDEPEND="=sys-apps/portage-2.1.2* gtk? ( >=dev-python/pygtk-2.8.6 >=x11-libs/vte-0.12.2 >=gnome-base/libglade-2.5.1 syntax? ( $used_syntax x11-libs/gtksourceview ) ) etcproposals? (>=app-portage/etcproposals-1.0) qt4? ( >=dev-python/PyQt4-4.1.1 )" S=${WORKDIR}/${PN} CONFIG_DIR="/etc/${PN}/" DATA_DIR="/usr/share/${PN}/" PLUGIN_DIR="${DATA_DIR}/plugins" apply_sed () { cd ${S}/${PN} frontends="[" std="" if use gtk; then frontends="$frontends\"gtk\"" std="gtk" fi if use qt4; then frontends="$frontends, \"qt\"" if test -z $std; then std="qt" fi fi frontends="${frontends/\[, /[}]" einfo "Building frontends: $frontends" sed -i -e "s;^\(VERSION\s*=\s*\).*;\1\"${PV}\";" \ -e "s;^\(CONFIG_DIR\s*=\s*\).*;\1\"${CONFIG_DIR}\";" \ -e "s;^\(DATA_DIR\s*=\s*\).*;\1\"${DATA_DIR}\";" \ -e "s;^\(PLUGIN_DIR\s*=\s*\).*;\1\"${PLUGIN_DIR}\";" \ -e "s;^\(FRONTENDS\s*=\s*\).*;\1$frontends;" \ -e "s;^\(STD_FRONTEND\s*=\s*\).*;\1\"$std\";" \ constants.py } install_plugin() { flag=$1 plugin=$2 if use $flag; then einfo "Installing plugin $plugin.xml" cp plugins/${plugin}.xml ${D}${PLUGIN_DIR} fi } pkg_setup () { if ! built_with_use x11-libs/vte python; then echo eerror "x11-libs/vte has not been built with python support." eerror "Please re-emerge vte with the python use-flag enabled." die "missing python flag for x11-libs/vte" fi if ! use gtk && ! use qt4 ; then echo eerror "You don't have set any frontend." eerror "Please set one, as a GUI w/o frontend is useless." die "no frontend chosen" fi } src_compile () { (apply_sed) || die "Applying sed-commands failed." distutils_src_compile } src_install () { dodir ${DATA_DIR} distutils_src_install cd ${S} newbin portato.py portato dodoc doc/* # config dodir ${CONFIG_DIR} cp etc/* ${D}${CONFIG_DIR} # plugins dodir ${PLUGIN_DIR} install_plugin syntax "ebuild_highlight" install_plugin etcproposals "etc_proposals" } pkg_postinst() { if use gtk && use syntax; then echo einfo "Sorry for having so much gnome dependencies." einfo "They are used by the \"syntax\" useflag, because we need" einfo "a small part of the gnome-python-desktop package." einfo "Blame upstream pygtk for bundling all those small projects" einfo "into a huge one." fi }