diff options
author | Oz Tiram <oz.tiram@gmail.com> | 2023-05-06 00:32:32 +0200 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-05-05 23:37:20 +0100 |
commit | a5db7dc669c20b0a5b5b79b230a0adb21c49064e (patch) | |
tree | 360f0b8e71ff7253fa4928257502983075609479 /dev-python/pipenv | |
parent | dev-python/pipenv: drop 2022.12.19 (diff) | |
download | gentoo-a5db7dc669c20b0a5b5b79b230a0adb21c49064e.tar.gz gentoo-a5db7dc669c20b0a5b5b79b230a0adb21c49064e.tar.bz2 gentoo-a5db7dc669c20b0a5b5b79b230a0adb21c49064e.zip |
dev-python/pipenv: remove toml dependency
Patch the upstream package to use tomli, also
declare tomli as dependency only if python is less than 3.11
Signed-off-by: Oz Tiram <oz.tiram@gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/30866
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-python/pipenv')
-rw-r--r-- | dev-python/pipenv/files/pipenv-2023.4.29-fix-toml-in-vendor.patch | 76 | ||||
-rw-r--r-- | dev-python/pipenv/pipenv-2023.4.29.ebuild | 10 |
2 files changed, 78 insertions, 8 deletions
diff --git a/dev-python/pipenv/files/pipenv-2023.4.29-fix-toml-in-vendor.patch b/dev-python/pipenv/files/pipenv-2023.4.29-fix-toml-in-vendor.patch new file mode 100644 index 000000000000..cb0f3f70d48b --- /dev/null +++ b/dev-python/pipenv/files/pipenv-2023.4.29-fix-toml-in-vendor.patch @@ -0,0 +1,76 @@ +diff --git a/pipenv/project.py b/pipenv/project.py +index ed43cf2bc..903667639 100644 +--- a/pipenv/project.py ++++ b/pipenv/project.py +@@ -13,6 +13,13 @@ import urllib.parse + from json.decoder import JSONDecodeError + from pathlib import Path + ++import click, tomlkit ++ ++try: ++ import tomllib as toml ++except ImportError: ++ import tomli as toml ++ + from pipenv.cmdparse import Script + from pipenv.environment import Environment + from pipenv.environments import Setting, is_in_virtualenv, normalize_pipfile_path +diff --git a/pipenv/utils/toml.py b/pipenv/utils/toml.py +index d4157d01c..27d9975ae 100644 +--- a/pipenv/utils/toml.py ++++ b/pipenv/utils/toml.py +@@ -1,4 +1,9 @@ +-from pipenv.vendor import toml, tomlkit ++try: ++ import tomllib as toml ++except ImportError: ++ import tomli as toml ++ ++import tomlkit + + + def cleanup_toml(tml): +diff --git a/pipenv/vendor/dparse/parser.py b/pipenv/vendor/dparse/parser.py +index faaad2e8e..4c59474e9 100644 +--- a/pipenv/vendor/dparse/parser.py ++++ b/pipenv/vendor/dparse/parser.py +@@ -10,6 +10,11 @@ from io import StringIO + from configparser import ConfigParser, NoOptionError + from pathlib import PurePath + ++try: ++ import tomllib as toml ++except ImportError: ++ import tomli as toml ++ + from .errors import MalformedDependencyFileError + from .regex import HASH_REGEX + +@@ -17,7 +22,6 @@ from .dependencies import DependencyFile, Dependency + from pipenv.patched.pip._vendor.packaging.requirements import Requirement as PackagingRequirement,\ + InvalidRequirement + from . import filetypes +-import pipenv.vendor.toml as toml + from pipenv.patched.pip._vendor.packaging.specifiers import SpecifierSet + from pipenv.patched.pip._vendor.packaging.version import Version, InvalidVersion + import json +diff --git a/pipenv/vendor/dparse/updater.py b/pipenv/vendor/dparse/updater.py +index 7b7ba9a53..fe20a213f 100644 +--- a/pipenv/vendor/dparse/updater.py ++++ b/pipenv/vendor/dparse/updater.py +@@ -3,9 +3,13 @@ from __future__ import absolute_import, print_function, unicode_literals + import re + import json + import tempfile +-import pipenv.vendor.toml as toml + import os + ++try: ++ import tomllib as toml ++except ImportError: ++ import tomli as toml ++ + + class RequirementsTXTUpdater(object): + SUB_REGEX = r"^{}(?=\s*\r?\n?$)" diff --git a/dev-python/pipenv/pipenv-2023.4.29.ebuild b/dev-python/pipenv/pipenv-2023.4.29.ebuild index 1ae17db21361..5fdc0ff53f40 100644 --- a/dev-python/pipenv/pipenv-2023.4.29.ebuild +++ b/dev-python/pipenv/pipenv-2023.4.29.ebuild @@ -22,6 +22,7 @@ PATCHES=( "${FILESDIR}/pipenv-2022.9.24-inject-site-packages.patch" "${FILESDIR}/pipenv-2023.4.29-append-always-install.patch" "${FILESDIR}/pipenv-2023.4.29-fix-imports.patch" + "${FILESDIR}/pipenv-2023.4.29-fix-toml-in-vendor.patch" ) RDEPEND=" @@ -33,7 +34,7 @@ RDEPEND=" >=dev-python/pexpect-4.8.0[${PYTHON_USEDEP}] >=dev-python/ptyprocess-0.7.0[${PYTHON_USEDEP}] dev-python/pyparsing[${PYTHON_USEDEP}] - dev-python/toml[${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}] @@ -90,13 +91,6 @@ src_prepare() { sed --in-place \ -e "s/from pipenv\.vendor import plette, toml, tomlkit, vistir/from pipenv\.vendor import plette, toml, vistir\\nimport tomlkit/g" - # remove tomlkit from vendoring - for fname in pipenv/utils/toml.py tests/integration/conftest.py; do - sed --in-place -e "s/from pipenv\.vendor import toml, tomlkit/from pipenv\.vendor import toml\\nimport tomlkit/g" $fname || die "Failed sed in $fname" - done - #for fname in "tests/unit/test_vendor.py "; do - # sed --in-place -e "s/from pipenv\.vendor import tomlkit/import tomlkit/g" $fname || die "Failed sed in tomlkit" - #done # 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" |