# Copyright 1999-2010 Tiziano Müller
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=3
PYTHON_USE_WITH="ncurses"
SUPPORT_PYTHON_ABIS="1"
SHA="39d97eb"

inherit distutils

DESCRIPTION="A free console file manager."
HOMEPAGE="http://github.com/hut/ranger"
SRC_URI="http://github.com/hut/ranger/tarball/v${PV} -> ${P}.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"
IUSE="doc"

DEPEND=""
RDEPEND=""

S="${WORKDIR}/hut-${PN}-${SHA}"
# spurious failures, wtf?
RESTRICT="test"

src_compile() {
	distutils_src_compile

	if use doc ; then
		emake doc || die "emake doc failed"
	fi
}

src_install() {
	distutils_src_install

	if use doc ; then
		dohtml doc/pydoc/*
	fi
}

src_test() {
	testing() {
		"$(PYTHON)" test/all_tests.py 1 || die "test failed for ABI ${PYTHON_ABI}"
	}
	python_execute_function testing
}