dev-python/pipenv: add 2026.6.1

Signed-off-by: Oz Tiram <oz.tiram@gmail.com>
This commit is contained in:
Oz Tiram
2026-04-29 16:10:07 +02:00
parent 2e3081e733
commit ccf184077d
5 changed files with 268 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST pipenv-2026.5.2.gh.tar.gz 10508957 BLAKE2B 76a31783f4653701b6ae5491df55954f567051b495cfc7fdc19a2f441618d90e0198fb2dd6c9f103d97027b17fd45e82d50e3db136ce5eeb764c9ac896cbd0e9 SHA512 4241a25af0c9aa581026e55f40f53b76411f6a264a2ef8d37298b4def19ae334d098d970c550b24e1da29003215ea34d4aa1f070de4d599d79ad7e114a5a1325 DIST pipenv-2026.5.2.gh.tar.gz 10508957 BLAKE2B 76a31783f4653701b6ae5491df55954f567051b495cfc7fdc19a2f441618d90e0198fb2dd6c9f103d97027b17fd45e82d50e3db136ce5eeb764c9ac896cbd0e9 SHA512 4241a25af0c9aa581026e55f40f53b76411f6a264a2ef8d37298b4def19ae334d098d970c550b24e1da29003215ea34d4aa1f070de4d599d79ad7e114a5a1325
DIST pipenv-2026.6.1.gh.tar.gz 10555997 BLAKE2B 3b97269ca898f9aa7dc9cbe8c037bd637750c61481491006b20ee7a90c8c811360bacad15b52bc15100576b6eb88894c7736c23e8a3940d308197e413260b2a8 SHA512 a2d3def9d27d0ad7fed2412e772e478093af11563711d370d428917d33cdb8bfc2181e098c7bd1e98b3334829665cdb11abd59c889b68daf4c9a094979a5ecd6

View File

@@ -0,0 +1,35 @@
From 2473b666137dd36321b017086084ae316d78dd2a Mon Sep 17 00:00:00 2001
From: Oz Tiram <oz.tiram@gmail.com>
Date: Wed, 8 Apr 2026 16:22:10 +0200
Subject: [PATCH 1/2] Append always install to pip extra args
---
pipenv/routines/install.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/pipenv/routines/install.py b/pipenv/routines/install.py
index 6d590346..301755fd 100644
--- a/pipenv/routines/install.py
+++ b/pipenv/routines/install.py
@@ -699,6 +699,18 @@ def batch_install_iteration(
allow_global=False,
extra_pip_args=None,
):
+
+ # Gentoo patch:
+ # Install dependencies into the venv even if they exist
+ # in the system.
+ # This is needed because pipenv imports the system packages to run.
+ # It does not change your system's packages.
+
+ if (extra_pip_args is not None) and ("-I" not in extra_pip_args):
+ extra_pip_args.append("-I")
+
+ # End of Gentoo patch
+
with temp_environ():
if not allow_global:
os.environ["PIP_USER"] = "0"
--
2.52.0

View File

@@ -0,0 +1,51 @@
From 2d73e02ec2587d35e142a5246be2afd823048380 Mon Sep 17 00:00:00 2001
From: Oz Tiram <oz.tiram@gmail.com>
Date: Wed, 8 Apr 2026 16:24:08 +0200
Subject: [PATCH 2/2] Inject system packages
---
pipenv/patched/pip/__main__.py | 9 +++++++++
pipenv/resolver.py | 7 +++++++
2 files changed, 16 insertions(+)
diff --git a/pipenv/patched/pip/__main__.py b/pipenv/patched/pip/__main__.py
index e76aed6e..c071b144 100644
--- a/pipenv/patched/pip/__main__.py
+++ b/pipenv/patched/pip/__main__.py
@@ -21,6 +21,15 @@ if __package__ == "":
if __name__ == "__main__":
import importlib.util
import sys
+
+ # GENTOO PATCH
+ SITE_PACKAGES_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
+
+ # Inject site directory into system path.
+ sys.path.insert(-1, SITE_PACKAGES_ROOT)
+
+ # END GENTOO PATCH
+
spec = importlib.util.spec_from_file_location(
"pipenv",
location=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "__init__.py"))
diff --git a/pipenv/resolver.py b/pipenv/resolver.py
index 350717cd..5762648a 100644
--- a/pipenv/resolver.py
+++ b/pipenv/resolver.py
@@ -7,6 +7,13 @@ from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Dict, List, Optional, Set
+# GENTOO PATCH
+SITE_PACKAGES_ROOT = os.path.dirname(os.path.dirname(__file__))
+
+# Inject site directory into system path.
+sys.path.insert(-1, SITE_PACKAGES_ROOT)
+
+# END GENTOO PATCH
def _ensure_modules():
# Try to ensure typing_extensions is available in sys.modules
--
2.52.0

View File

@@ -0,0 +1,78 @@
From e974b2ca4114acc5feb6c3274a44128e43cb3ef3 Mon Sep 17 00:00:00 2001
From: Oz Tiram <oz.tiram@gmail.com>
Date: Wed, 29 Apr 2026 10:36:08 +0200
Subject: [PATCH] fix(graph): inject pipdeptree parent into PYTHONPATH for
system installs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On Gentoo, vendored pip dependencies are de-bundled, so
`pipenv.vendor.pipdeptree` resolves to the system pipdeptree
(e.g. /usr/lib/python3.12/site-packages/pipdeptree/).
When pipenv runs it via the virtualenv's Python, that interpreter
cannot find `pipdeptree` — causing a ModuleNotFoundError.
Fix by injecting pipdeptree_path.parent into PYTHONPATH before
invoking the subprocess in both graph.py and update.py. The -l
(local-only) flag still filters enumerated packages to the
virtualenv via sys.prefix, so the graph output is unaffected.
Signed-off-by: Oz Tiram <oz.tiram@gmail.com>
---
pipenv/routines/graph.py | 13 ++++++++++++-
pipenv/routines/update.py | 8 +++++++-
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/pipenv/routines/graph.py b/pipenv/routines/graph.py
index a1df5965..954ca326 100644
--- a/pipenv/routines/graph.py
+++ b/pipenv/routines/graph.py
@@ -1,4 +1,5 @@
import json as simplejson
+import os
import sys
from pathlib import Path
@@ -51,7 +52,17 @@ def do_graph(project, bare=False, json=False, json_tree=False, reverse=False):
)
sys.exit(1)
- c = run_command(cmd_args, is_verbose=project.s.is_verbose())
+ # Ensure pipdeptree's parent directory is on PYTHONPATH so the virtualenv
+ # Python can import pipdeptree. This is necessary when pipdeptree is a
+ # system package (e.g. Gentoo unbundles vendored deps) rather than the
+ # copy vendored inside pipenv.
+ env = os.environ.copy()
+ pythonpath_parts = [str(pipdeptree_path.parent)]
+ if existing := env.get("PYTHONPATH"):
+ pythonpath_parts.append(existing)
+ env["PYTHONPATH"] = os.pathsep.join(pythonpath_parts)
+
+ c = run_command(cmd_args, is_verbose=project.s.is_verbose(), env=env)
# Run dep-tree.
if not bare:
diff --git a/pipenv/routines/update.py b/pipenv/routines/update.py
index 2dc4a289..bc0f605d 100644
--- a/pipenv/routines/update.py
+++ b/pipenv/routines/update.py
@@ -122,7 +122,13 @@ def get_reverse_dependencies(project) -> Dict[str, Set[Tuple[str, str]]]:
python_path = project.python()
cmd_args = [python_path, str(pipdeptree_path), "-l", "--reverse", "--json-tree"]
- c = run_command(cmd_args, is_verbose=project.s.is_verbose())
+ env = os.environ.copy()
+ pythonpath_parts = [str(pipdeptree_path.parent)]
+ if existing := env.get("PYTHONPATH"):
+ pythonpath_parts.append(existing)
+ env["PYTHONPATH"] = os.pathsep.join(pythonpath_parts)
+
+ c = run_command(cmd_args, is_verbose=project.s.is_verbose(), env=env)
if c.returncode != 0:
raise PipenvCmdError(c.err, c.out, c.returncode)
try:
--
2.52.0

View File

@@ -0,0 +1,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_{11..14} pypy3_11 )
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/
}