+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+DISTUTILS_USE_SETUPTOOLS=rdepend
+inherit distutils-r1
+
+MY_PN="python-${PN}"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Python wrapper for the Cloudflare Client API v4"
+HOMEPAGE="https://github.com/cloudflare/python-cloudflare"
+SRC_URI="https://github.com/cloudflare/${MY_PN}/archive/${PV}.tar.gz -> ${MY_P}.tar.gz"
+
+LICENSE="MIT-with-advertising"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="examples"
+
+RDEPEND="
+ dev-python/requests[${PYTHON_USEDEP}]
+ dev-python/future[${PYTHON_USEDEP}]
+ dev-python/pyyaml[${PYTHON_USEDEP}]
+ dev-python/jsonlines[${PYTHON_USEDEP}]
+"
+
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+ sed -i -e "s:packages=.*:packages=['cli4', 'CloudFlare'],:" -i setup.py || die
+ sed -i -e "/data_files = /d" -i setup.py || die
+ distutils-r1_src_prepare
+}
+
+python_install_all() {
+ if use examples; then
+ dodoc -r examples
+ docompress -x /usr/share/doc/${PF}/examples
+ fi
+
+ newman cli4/cli4.man cli4.1
+
+ distutils-r1_python_install_all
+}