You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/net-proxy/sshuttle/sshuttle-1.1.1.ebuild

75 lines
2.0 KiB

# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# Generate using https://github.com/thesamesam/sam-gentoo-scripts/blob/main/niche/generate-sshuttle-docs
# Set to 1 if prebuilt, 0 if not
# (the construct below is to allow overriding from env for script)
: ${SSHUTTLE_DOCS_PREBUILT:=1}
SSHUTTLE_DOCS_PREBUILT_DEV=sam
SSHUTTLE_DOCS_VERSION=${PV}
# Default to generating docs (inc. man pages) if no prebuilt; overridden later
SSHUTTLE_DOCS_USEFLAG="+doc"
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{9..11} )
inherit distutils-r1 linux-info pypi
DESCRIPTION="Transparent proxy server that works as a poor man's VPN using ssh"
HOMEPAGE="https://github.com/sshuttle/sshuttle https://pypi.org/project/sshuttle/"
if [[ ${SSHUTTLE_DOCS_PREBUILT} == 1 ]] ; then
SRC_URI+=" !doc? ( https://dev.gentoo.org/~${SSHUTTLE_DOCS_PREBUILT_DEV}/distfiles/${CATEGORY}/${PN}/${PN}-${SSHUTTLE_DOCS_VERSION}-docs.tar.xz )"
SSHUTTLE_DOCS_USEFLAG="doc"
fi
LICENSE="LGPL-2.1+"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="${SSHUTTLE_DOCS_USEFLAG}"
BDEPEND="
doc? ( dev-python/sphinx )
test? (
dev-python/mock[${PYTHON_USEDEP}]
)
"
RDEPEND="
dev-python/psutil[${PYTHON_USEDEP}]
|| ( net-firewall/iptables net-firewall/nftables )
"
CONFIG_CHECK="~NETFILTER_XT_TARGET_HL ~IP_NF_TARGET_REDIRECT ~IP_NF_MATCH_TTL ~NF_NAT"
distutils_enable_tests pytest
python_prepare_all() {
# Don't run tests via setup.py pytest
sed -i "/setup_requires=/s/'pytest-runner'//" setup.py || die
# Don't require pytest-cov when running tests
sed -i "s/^addopts =/#\0/" setup.cfg || die
distutils-r1_python_prepare_all
}
python_compile_all() {
if use doc ; then
emake -j1 -C docs html man
fi
}
python_install_all() {
# If USE=doc, there'll be newly generated docs which we install instead.
if ! use doc && [[ ${SSHUTTLE_DOCS_PREBUILT} == 1 ]] ; then
doman "${WORKDIR}"/${PN}-${SSHUTTLE_DOCS_VERSION}-docs/sshuttle.1
else
HTML_DOCS=( docs/_build/html/. )
doman docs/_build/man/*
fi
distutils-r1_python_install_all
}