blob: b912dfe509920f006d27c3623eb1ce4f8f52445b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{9,10,11,12,13} pypy3 )
inherit distutils-r1
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${PV}.tar.gz -> ${P}.gh.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~riscv"
PATCHES=(
"${FILESDIR}/pipenv-${PV}-0001-Append-always-install-to-pip-extra-args.patch"
"${FILESDIR}/pipenv-${PV}-0002-Inject-system-packages.patch"
"${FILESDIR}/pipenv-${PV}-0003-fix-graph-inject-pipdeptree-parent-into-PYTHONPATH.patch"
)
RDEPEND="
>=dev-python/pexpect-4.8.0[${PYTHON_USEDEP}]
~dev-python/pipdeptree-2.34.0[${PYTHON_USEDEP}]
~dev-python/plette-2.2.1[${PYTHON_USEDEP}]
>=dev-python/ptyprocess-0.7.0[${PYTHON_USEDEP}]
>=dev-python/python-dotenv-0.21.0[${PYTHON_USEDEP}]
>=dev-python/pythonfinder-3.0.0[${PYTHON_USEDEP}]
dev-python/shellingham[${PYTHON_USEDEP}]
dev-python/tomlkit[${PYTHON_USEDEP}]
>=dev-python/virtualenv-20.0.35[${PYTHON_USEDEP}]
"
BDEPEND="
${RDEPEND}
test? (
dev-python/flaky[${PYTHON_USEDEP}]
dev-python/mock[${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 pkgName
local packages=(
dotenv
pexpect
pipdeptree
plette
pythonfinder
shellingham
tomli
tomlkit
)
for pkgName in "${packages[@]}"; do
find ./ -type f -exec 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" \
-e "s/from .vendor import ${pkgName}/import ${pkgName}/g" \
-e "s/from .vendor.${pkgName}/from ${pkgName}/g" {} + || die "Failed to sed for ${pkgName}"
done
# disable coverage in tests
sed -i -e '/\[tool\.pytest\.ini_options\]/,/\[/ { /addopts/d; /plugins/d; }' pyproject.toml || die
distutils-r1_src_prepare
# remove vendored versions
for pkgName in "${packages[@]}"; do
# Match the name directly (works for directories and files)
# We use -o (OR) to handle both the original name and the hyphenated version
find ./pipenv/vendor \( -name "${pkgName}" -o -name "${pkgName/_/-}" \) \
-prune -exec rm -rvf {} + || die "Failed to remove vendored ${pkgName}"
done
find tests/ -type f -name "*.py" -exec sed -i \
-e "s/pipenv\.vendor\.pythonfinder\.utils\.get_python_version/pythonfinder.utils.get_python_version/g" \
-e "s/from pipenv\.vendor /from /g" \
-e "s/import pipenv\.vendor\./import /g" \
{} + || die "Failed to devendor tests"
rm -rv examples docs benchmarks || die "Failed to remove dirs"
}
EPYTEST_PLUGINS=()
distutils_enable_tests pytest
python_test() {
local -x PYTHONPATH="${S}:${PYTHONPATH}"
epytest -m "not cli and not needs_internet" tests/unit/
}
|