# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

# TODO: for nghttp2 support I need to add python support to nghttp2's
# ebuild and then depend on nghttp2[${PYTHON_USEDEP}] if the nghttp2
# USE flag is set

# TODO: also the test USE flag for running tests/

# hpack's pypi tarballs don't include docs (probably because it's not in
# MANIFEST.in), so I have to use the github tarball for now

EAPI=5

PYTHON_COMPAT=(python2_7 python3_3 python3_4 python3_5)

inherit distutils-r1

DESCRIPTION="Pure-Python implementation of HPACK for http/2 used by hyper"
HOMEPAGE="http://python-hyper.org/hpack/en/latest/ https://pypi.python.org/pypi/hpack"
SRC_URI="https://github.com/python-hyper/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc"

RDEPEND=""
DEPEND="${RDEPEND}
	doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )"

DOCS=(README.rst CONTRIBUTORS.rst HISTORY.rst)

python_compile_all() {
	use doc && emake -C docs html
}

python_install_all() {
	use doc && local HTML_DOCS=( docs/build/html/. )

	distutils-r1_python_install_all
}
