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/dev-python/pipenv/pipenv-2021.11.23.ebuild

82 lines
2.5 KiB

# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_SETUPTOOLS=rdepend
PYTHON_COMPAT=( python3_{8..10} )
inherit distutils-r1 multiprocessing
MY_PV=${PV/_beta/b}
DESCRIPTION="Python Development Workflow for Humans"
HOMEPAGE="https://github.com/pypa/pipenv https://pypi.org/project/pipenv/"
SRC_URI="https://github.com/pypa/pipenv/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}"/${PN}-${MY_PV}
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="test"
RESTRICT="!test? ( test )"
RDEPEND="
${PYTHON_DEPS}
dev-python/attrs[${PYTHON_USEDEP}]
>=dev-python/colorama-0.4.4[${PYTHON_USEDEP}]
>=dev-python/idna-3.2[${PYTHON_USEDEP}]
>=dev-python/pexpect-4.8.0[${PYTHON_USEDEP}]
dev-python/pip[${PYTHON_USEDEP}]
>=dev-python/python-dateutil-2.8.2[${PYTHON_USEDEP}]
>=dev-python/virtualenv-20.0.35[${PYTHON_USEDEP}]
dev-python/virtualenv-clone[${PYTHON_USEDEP}]
>=dev-python/requests-2.26.0[${PYTHON_USEDEP}]
>=dev-python/urllib3-1.26.7[${PYTHON_USEDEP}]
>=dev-python/wheel-0.36.0[${PYTHON_USEDEP}]
>=dev-python/zipp-3.6.0[${PYTHON_USEDEP}]
"
BDEPEND="
${RDEPEND}
test? (
dev-python/flaky[${PYTHON_USEDEP}]
dev-python/mock[${PYTHON_USEDEP}]
dev-python/pytest[${PYTHON_USEDEP}]
dev-python/pytz[${PYTHON_USEDEP}]
)
"
# IMPORTANT: The following sed command patches the vendor direcotry
# in the pipenv source. Attempts to simply bump the version of the
# package without checking that it works is likely to fail
# The vendored packages should eventually all be removed
# see: https://bugs.gentoo.org/717666
src_prepare() {
local jobs=$(makeopts_jobs)
local packages=( attr colorama idna pexpect dateutil requests urllib3 zipp )
for pkgName in ${packages[@]}; do
find ./ -type f -print0 | \
xargs --max-procs="${jobs}" --null \
sed --in-place \
-e 's/from pipenv.vendor import '"${pkgName}"'/import '"${pkgName}"'/g' \
-e 's/from pipenv.vendor.'"${pkgName}"'\(.*\) import \(\w*\)/from '"${pkgName}"'\1 import \2/g' \
-e 's/import pipenv.vendor.'"${pkgName}"' as '"${pkgName}"'/import '"${pkgName}"'/g'
done
assert "Failed to sed sources"
distutils-r1_src_prepare
# remove vendored versions
for pkgName in ${packages[@]}; do
find ./pipenv/vendor/ -name "${pkgName}*" -prune -exec rm -rvf {} + || die
done
# not actually used by pipenv, but included in pipenv
rm -vR "${S}/${PN}/vendor/wheel/" || die
}
python_test() {
pytest -vvv -x -m "not cli and not needs_internet" tests/unit/ || die
}