--- radare.orig/radare-1.5.2-r1.ebuild 2011-03-23 14:31:12.000000000 +0800 +++ radare.orig/radare-1.5.2-r1.ebuild 2011-11-26 22:49:46.026000063 +0800 @@ -3,7 +3,9 @@ # $Header: /var/cvsroot/gentoo-x86/dev-util/radare/radare-1.5.2-r1.ebuild,v 1.2 2011/03/23 06:20:21 ssuominen Exp $ EAPI="3" -inherit base eutils +PYTHON_DEPEND="2" + +inherit base eutils python DESCRIPTION="Advanced command line hexadecimal editor and more" HOMEPAGE="http://www.radare.org" @@ -15,7 +17,6 @@ IUSE="gui lua readline" RDEPEND=" - dev-lang/python dev-lang/perl gui? ( x11-libs/gtk+:2 @@ -26,6 +27,14 @@ dev-util/pkgconfig gui? ( >=dev-lang/vala-0.5:0.10 )" +pkg_setup() { + if [[ $(eselect python show) == "python2.5" ]]; then + python_set_active_version 2.5 + elif [[ $(eselect python show) == "python2.6" ]]; then + python_set_active_version 2.6 + fi +} + src_prepare() { base_src_prepare epatch "${FILESDIR}"/${PN}-1.5-ldflags.patch \ @@ -42,9 +51,27 @@ } src_compile() { - emake -j1 || die "compile failed" + emake || die "compile failed" } src_install() { emake DESTDIR="${ED}" install || die "install failed" } + +pkg_postinst() { + if [[ $(eselect python show) == "python2.5" ]] || + [[ $(eselect python show) == "python2.6" ]]; then + python_mod_optimize radare + else + ewarn "optimization of python modules can only occur" + ewarn "if the active version of python is 2.5 or 2.6" + ewarn "this will be skipped" + fi +} + +pkg_postrm() { + if ([[ $(eselect python show) == "python2.5" ]]) || \ + ([[ $(eselect python show) == "python2.6" ]]); then + python_mod_cleanup radare + fi +}