public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pipenv/, dev-python/pipenv/files/
Date: Fri,  5 May 2023 22:37:32 +0000 (UTC)	[thread overview]
Message-ID: <1683326240.a5db7dc669c20b0a5b5b79b230a0adb21c49064e.sam@gentoo> (raw)

commit:     a5db7dc669c20b0a5b5b79b230a0adb21c49064e
Author:     Oz Tiram <oz.tiram <AT> gmail <DOT> com>
AuthorDate: Fri May  5 22:32:32 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> 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 <oz.tiram <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/30866
Signed-off-by: Sam James <sam <AT> 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"


             reply	other threads:[~2023-05-05 22:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05 22:37 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-01-06 14:08 [gentoo-commits] repo/gentoo:master commit in: dev-python/pipenv/, dev-python/pipenv/files/ Michał Górny
2023-10-27  3:25 Sam James
2023-10-27  3:25 Sam James
2023-08-11  7:31 Joonas Niilola
2023-05-20 12:32 Joonas Niilola
2022-05-16 13:11 Michał Górny
2022-01-09  1:23 Sam James
2021-08-18 13:33 Joonas Niilola
2020-05-08 17:26 Sebastian Pipping

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1683326240.a5db7dc669c20b0a5b5b79b230a0adb21c49064e.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox