From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D9D7E15ACFC for ; Fri, 5 May 2023 22:37:35 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9DFFCE09CF; Fri, 5 May 2023 22:37:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6C75FE09CF for ; Fri, 5 May 2023 22:37:34 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A29E3341513 for ; Fri, 5 May 2023 22:37:33 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 383B9A60 for ; Fri, 5 May 2023 22:37:32 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1683326240.a5db7dc669c20b0a5b5b79b230a0adb21c49064e.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pipenv/, dev-python/pipenv/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-python/pipenv/files/pipenv-2023.4.29-fix-toml-in-vendor.patch dev-python/pipenv/pipenv-2023.4.29.ebuild X-VCS-Directories: dev-python/pipenv/files/ dev-python/pipenv/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: a5db7dc669c20b0a5b5b79b230a0adb21c49064e X-VCS-Branch: master Date: Fri, 5 May 2023 22:37:32 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: c83b70d4-b0ea-44dd-b1df-e4db621883f4 X-Archives-Hash: 6373904a9f1488d70366391ac5ec19cd commit: a5db7dc669c20b0a5b5b79b230a0adb21c49064e Author: Oz Tiram gmail com> AuthorDate: Fri May 5 22:32:32 2023 +0000 Commit: Sam James gentoo org> CommitDate: Fri May 5 22:37:20 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a5db7dc6 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 gmail.com> Closes: https://github.com/gentoo/gentoo/pull/30866 Signed-off-by: Sam James gentoo.org> .../pipenv-2023.4.29-fix-toml-in-vendor.patch | 76 ++++++++++++++++++++++ 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"