diff options
author | Oz Tiram <oz.tiram@gmail.com> | 2023-09-24 09:52:11 +0200 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-10-27 04:23:50 +0100 |
commit | b7d00239ce93b213031e3b716b42522d4cdd40a1 (patch) | |
tree | f31ba3848e2b3aff06dc7b4b454fe8817b966df8 /dev-python | |
parent | dev-python/dparse: new package, add 0.6.3 (diff) | |
download | gentoo-b7d00239ce93b213031e3b716b42522d4cdd40a1.tar.gz gentoo-b7d00239ce93b213031e3b716b42522d4cdd40a1.tar.bz2 gentoo-b7d00239ce93b213031e3b716b42522d4cdd40a1.zip |
dev-python/pipenv: add 2023.9.8
Bug: https://bugs.gentoo.org/717666
Signed-off-by: Oz Tiram <oz.tiram@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-python')
4 files changed, 212 insertions, 0 deletions
diff --git a/dev-python/pipenv/Manifest b/dev-python/pipenv/Manifest index f0b6618dab16..123eb06e474d 100644 --- a/dev-python/pipenv/Manifest +++ b/dev-python/pipenv/Manifest @@ -1,2 +1,3 @@ DIST pipenv-2023.4.29.gh.tar.gz 10808706 BLAKE2B 31432b80f82b041969e75d0ec0a28ca90068395be25dac94a7f34526f0b638adfae59e9396b147fa61592ee78af2d9cfb4a1b65dedea9bbb299b2624a6d6e9a1 SHA512 870b33ced4ed909b23b9d345ec788f4b5fffde4b253755e8a41b0629e885ef49ca14e9a68b5919b70074829002603fe427e8b77f41028a7de33d269a910354ff DIST pipenv-2023.7.11.gh.tar.gz 10828051 BLAKE2B 3eeab9c5328dc5914e7e024f07bf105241ca777187ce50d5765f0ca1bb7270d8c6bda6a842b188fcacb57ba8bf5d0ed5f7b29b9edce5d45e485c8079691ac991 SHA512 d37cf030f4f77d4c95d0f0883140b1e829d4473b43fdc3f61c3d39827fdf9c98ecfc794d3eacf3ebedb55dadb018416c1250938a193a6382ac61ce859d19e193 +DIST pipenv-2023.9.8.gh.tar.gz 10819425 BLAKE2B 3fd67d5aa7022251660c09d47e6d2487eabca507dbac8ebb2c298ef46cae452e6f2330615053d80a404f98ce523e5ff15ef89adbc85779305633b45e6b989423 SHA512 328cab44cea16bb685f745f80804e2a8b951e93a24379d5b61faeae4730e58d48cff663652f785800dd1dffc7a05f398ca54eb5118cd4fcfa43c35dad86f60eb diff --git a/dev-python/pipenv/files/pipenv-2023.9.8-append-always-install-to-pip-extra-args.patch b/dev-python/pipenv/files/pipenv-2023.9.8-append-always-install-to-pip-extra-args.patch new file mode 100644 index 000000000000..d97987fd0db3 --- /dev/null +++ b/dev-python/pipenv/files/pipenv-2023.9.8-append-always-install-to-pip-extra-args.patch @@ -0,0 +1,34 @@ +From 8ee76835b2d615156bb6d329417d6ce8d19bfa3a Mon Sep 17 00:00:00 2001 +From: Oz Tiram <oz.tiram@gmail.com> +Date: Wed, 20 Sep 2023 23:11:27 +0200 +Subject: [PATCH 2/4] Append always install to pip extra args + +--- + pipenv/routines/install.py | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/pipenv/routines/install.py b/pipenv/routines/install.py +index 2f135b435..e30f2da52 100644 +--- a/pipenv/routines/install.py ++++ b/pipenv/routines/install.py +@@ -459,6 +459,17 @@ 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.41.0 + diff --git a/dev-python/pipenv/files/pipenv-2023.9.8-inject-system-packages.patch b/dev-python/pipenv/files/pipenv-2023.9.8-inject-system-packages.patch new file mode 100644 index 000000000000..cf211f1ab846 --- /dev/null +++ b/dev-python/pipenv/files/pipenv-2023.9.8-inject-system-packages.patch @@ -0,0 +1,53 @@ +From b6b25911c050f0bec192e5ccb09ddc6dc3d5fa7d Mon Sep 17 00:00:00 2001 +From: Oz Tiram <oz.tiram@gmail.com> +Date: Wed, 20 Sep 2023 23:03:57 +0200 +Subject: [PATCH 1/4] Inject system packages + +--- + pipenv/patched/pip/__main__.py | 8 ++++++++ + pipenv/resolver.py | 6 ++++++ + 2 files changed, 14 insertions(+) + +diff --git a/pipenv/patched/pip/__main__.py b/pipenv/patched/pip/__main__.py +index 032297163..59f7ad19e 100644 +--- a/pipenv/patched/pip/__main__.py ++++ b/pipenv/patched/pip/__main__.py +@@ -21,10 +21,18 @@ if __package__ == "": + if __name__ == "__main__": + import importlib.util + import sys ++ ++ 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) ++ + spec = importlib.util.spec_from_file_location( + "pipenv", location=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "__init__.py")) + pipenv = importlib.util.module_from_spec(spec) + sys.modules["pipenv"] = pipenv ++ ++ + spec.loader.exec_module(pipenv) + from pipenv.patched.pip._internal.cli.main import main as _main + +diff --git a/pipenv/resolver.py b/pipenv/resolver.py +index 82e01ca39..29461b878 100644 +--- a/pipenv/resolver.py ++++ b/pipenv/resolver.py +@@ -10,6 +10,12 @@ except ImportError: + cached_property = property + + ++SITE_PACKAGES_ROOT = os.path.dirname(os.path.dirname(__file__)) ++ ++# Inject site directory into system path. ++sys.path.insert(-1, SITE_PACKAGES_ROOT) ++ ++ + def _ensure_modules(): + spec = importlib.util.spec_from_file_location( + "typing_extensions", +-- +2.41.0 + diff --git a/dev-python/pipenv/pipenv-2023.9.8.ebuild b/dev-python/pipenv/pipenv-2023.9.8.ebuild new file mode 100644 index 000000000000..6b7786ff6f88 --- /dev/null +++ b/dev-python/pipenv/pipenv-2023.9.8.ebuild @@ -0,0 +1,124 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{10..11} ) + +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}.gh.tar.gz" +S="${WORKDIR}"/${PN}-${MY_PV} + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" + +PATCHES=( + "${FILESDIR}/pipenv-2023.9.8-inject-system-packages.patch" + "${FILESDIR}/pipenv-2023.9.8-append-always-install-to-pip-extra-args.patch" +) + +RDEPEND=" + >=dev-python/cerberus-1.3.2[${PYTHON_USEDEP}] + dev-python/click[${PYTHON_USEDEP}] + dev-python/click-didyoumean[${PYTHON_USEDEP}] + >=dev-python/colorama-0.4.4[${PYTHON_USEDEP}] + dev-python/dparse[${PYTHON_USEDEP}] + >=dev-python/markupsafe-2.0.1[${PYTHON_USEDEP}] + >=dev-python/pexpect-4.8.0[${PYTHON_USEDEP}] + dev-python/pipdeptree[${PYTHON_USEDEP}] + dev-python/plette[${PYTHON_USEDEP}] + >=dev-python/ptyprocess-0.7.0[${PYTHON_USEDEP}] + <dev-python/pydantic-2.0.0[${PYTHON_USEDEP}] + dev-python/pyparsing[${PYTHON_USEDEP}] + dev-python/pythonfinder[${PYTHON_USEDEP}] + $(python_gen_cond_dep ' dev-python/tomli[${PYTHON_USEDEP}] ' python3_{9..10}) + >=dev-python/python-dateutil-2.8.2[${PYTHON_USEDEP}] + >=dev-python/python-dotenv-0.21.0[${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/ruamel-yaml[${PYTHON_USEDEP}] + dev-python/shellingham[${PYTHON_USEDEP}] + dev-python/tomli[${PYTHON_USEDEP}] + dev-python/tomlkit[${PYTHON_USEDEP}] +" + +BDEPEND=" + ${RDEPEND} + test? ( + dev-python/flaky[${PYTHON_USEDEP}] + dev-python/mock[${PYTHON_USEDEP}] + dev-python/pytz[${PYTHON_USEDEP}] + ) +" + +distutils_enable_tests pytest + +# 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() { + sed --in-place -e "s/import click, plette, tomlkit/import click\n\import tomlkit\nfrom pipenv.vendor import plette/g" pipenv/project.py || die "Failed patching pipenv/project.py" + + local pkgName + local jobs=$(makeopts_jobs) + local packages=( cerberus colorama click click_didyoumean dotenv dparse markupsafe \ + pexpect pep517 pipdeptree plette ptyprocess pydantic pyparsing pythonfinder \ + requests urllib3 shellingham tomli tomlkit ) + 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" \ + -e "s/from .vendor import ${pkgName}/import ${pkgName}/g" || die "Failed to sed for ${pkgName}" + done + + distutils-r1_src_prepare + + # remove vendored versions + for pkgName in ${packages[@]}; do + find ./pipenv/vendor -regextype posix-extended -regex ".*${pkgName}$" -prune -exec rm -rvf {} + || die + # package names can be foo-bar, their module will be however foo_bar + find ./pipenv/vendor -regextype posix-extended -regex ".*${pkgName/_/-}" -prune -exec rm -rvf {} + || die + done + + find ./pipenv/vendor -regextype posix-extended -regex '.*cached[_-]property.*' -prune -exec rm -rvf {} + || die + + find ./ -type f -print0 | \ + xargs --max-procs="${jobs}" --null \ + sed --in-place \ + -e "s/from pipenv\.vendor import plette, toml, tomlkit, vistir/from pipenv\.vendor import plette, toml, vistir\\nimport tomlkit/g" + + # remove python ruaml yaml + sed --in-place -e \ + "s/from pipenv\.vendor\.ruamel\.yaml import YAML/from ruamel\.yaml import YAML/g" \ + pipenv/patched/safety/util.py || die "Failed sed in ruaml-yaml" + sed --in-place -e \ + "s/from pipenv\.vendor\.ruamel\.yaml\.error import MarkedYAMLError/from ruamel\.yaml\.error import MarkedYAMLError/g" \ + pipenv/patched/safety/util.py || die "Failed sed in ruamel-yaml" + + rm -vR pipenv/vendor/ruamel || die "Failed removing ruamel-yaml from vendor" + + for fname in Makefile README.md ruamel.*.LICENSE vendor.txt; do + rm -v pipenv/vendor/$fname || die "Failed removing pipenv/vendor/${fname}" + done + + sed --in-place -e "s/pipenv.vendor.pythonfinder.utils.get_python_version/pythonfinder.utils.get_python_version/g" tests/unit/test_utils.py || die "Failed patching tests" + + rm -Rfv pipenv/vendor || die "Could not vendor" + rm -Rfv examples || die "Could not remove examples" +} + +python_test() { + epytest -m "not cli and not needs_internet" tests/unit/ +} |