public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/python-multipart/, dev-python/python-multipart/files/
@ 2022-11-21 11:44 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2022-11-21 11:44 UTC (permalink / raw
  To: gentoo-commits

commit:     72e79e8b617d940858d2407cc86c213c38d83aba
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 21 11:36:21 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Nov 21 11:44:13 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=72e79e8b

dev-python/python-multipart: New package, v0.0.5

This a test dependency of dev-python/starlette.  Note that it actually
installs a `multipart` package, that conflicts with PyPI `multipart`.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/python-multipart/Manifest               |  1 +
 .../files/python-multipart-0.0.5-pyyaml.patch      | 29 ++++++++++++++++++
 dev-python/python-multipart/metadata.xml           | 13 ++++++++
 .../python-multipart/python-multipart-0.0.5.ebuild | 35 ++++++++++++++++++++++
 4 files changed, 78 insertions(+)

diff --git a/dev-python/python-multipart/Manifest b/dev-python/python-multipart/Manifest
new file mode 100644
index 000000000000..cdb993e00fa1
--- /dev/null
+++ b/dev-python/python-multipart/Manifest
@@ -0,0 +1 @@
+DIST python-multipart-0.0.5.gh.tar.gz 48018 BLAKE2B cfff5c1c57ada3ba3d50da71273435781d62d3907ca1b7e6180cd319f2680258b3e1e278dff760106e7ca9c116f4c5c7adf957601d6d8465bf300e6211b83773 SHA512 c2fabeb77a25119c4bbb71c3faa6de58e27ac2f0c768298eac62b519fc51e5d95fdea05c4f3846ed47205f297802982a001577a73b2feec2d9f585c784d6c3d7

diff --git a/dev-python/python-multipart/files/python-multipart-0.0.5-pyyaml.patch b/dev-python/python-multipart/files/python-multipart-0.0.5-pyyaml.patch
new file mode 100644
index 000000000000..5d189dd5f225
--- /dev/null
+++ b/dev-python/python-multipart/files/python-multipart-0.0.5-pyyaml.patch
@@ -0,0 +1,29 @@
+From 4831a3f9b5007145f2cb9e3020e83581523d4079 Mon Sep 17 00:00:00 2001
+From: Carl George <carl@george.computer>
+Date: Tue, 19 Apr 2022 20:20:49 -0500
+Subject: [PATCH] Use yaml.safe_load instead of yaml.load (#46)
+
+yaml.load in PyYAML 6 requires a Loader argument.  PyYAML recommends
+using SafeLoader, which is implied if you call yaml.safe_load instead.
+
+https://github.com/yaml/pyyaml/pull/561
+https://msg.pyyaml.org/load
+
+Fixes #41
+---
+ multipart/tests/test_multipart.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/multipart/tests/test_multipart.py b/multipart/tests/test_multipart.py
+index 0e38c9c..ab33e7c 100644
+--- a/multipart/tests/test_multipart.py
++++ b/multipart/tests/test_multipart.py
+@@ -716,7 +716,7 @@ def test_not_aligned(self):
+             test_data = f.read()
+ 
+         with open(yaml_file, 'rb') as f:
+-            yaml_data = yaml.load(f)
++            yaml_data = yaml.safe_load(f)
+ 
+         http_tests.append({
+             'name': fname,

diff --git a/dev-python/python-multipart/metadata.xml b/dev-python/python-multipart/metadata.xml
new file mode 100644
index 000000000000..7efb07682e6c
--- /dev/null
+++ b/dev-python/python-multipart/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="project">
+		<email>python@gentoo.org</email>
+		<name>Python</name>
+	</maintainer>
+	<stabilize-allarches/>
+	<upstream>
+		<remote-id type="pypi">python-multipart</remote-id>
+		<remote-id type="github">andrew-d/python-multipart</remote-id>
+	</upstream>
+</pkgmetadata>

diff --git a/dev-python/python-multipart/python-multipart-0.0.5.ebuild b/dev-python/python-multipart/python-multipart-0.0.5.ebuild
new file mode 100644
index 000000000000..6b9e2b9792cd
--- /dev/null
+++ b/dev-python/python-multipart/python-multipart-0.0.5.ebuild
@@ -0,0 +1,35 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( pypy3 python3_{8..11} )
+
+inherit distutils-r1
+
+DESCRIPTION="A streaming multipart parser for Python"
+HOMEPAGE="
+	https://github.com/andrew-d/python-multipart/
+	https://pypi.org/project/python-multipart/
+"
+SRC_URI="
+	https://github.com/andrew-d/python-multipart/archive/${PV}.tar.gz
+		-> ${P}.gh.tar.gz
+"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+BDEPEND="
+	test? (
+		dev-python/pyyaml[${PYTHON_USEDEP}]
+	)
+"
+
+distutils_enable_tests pytest
+
+PATCHES=(
+	"${FILESDIR}"/${P}-pyyaml.patch
+)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/python-multipart/, dev-python/python-multipart/files/
@ 2024-10-19  8:53 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2024-10-19  8:53 UTC (permalink / raw
  To: gentoo-commits

commit:     6afa196ca0cb1604875847b1b84fa64896a06f6e
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 18 13:13:06 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Oct 19 08:53:00 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6afa196c

dev-python/python-multipart: Hard-rename to python_multipart

Hard-rename the Python package to `python_multipart`, to avoid conflicts
with the `multipart` PyPI package.

Both `multipart` and `python-multipart` packages install using
`multipart` import name, therefore both cannot be installed at the same
time.  Historically, we have included only the latter in Gentoo, since
it was pulled in as a dependency of dev-python/starlette.  However,
the former was recently made the recommended replacement
for the deprecated and removed `cgi` standard library module, therefore
other packages started depending on it.

Given that both packages intend to be maintained throughout
the foreseeable future, it seems that the best workaround is to rename
one of them.  In this case, `python-multipart` uses an import name
that does not match the package and seems to be have fewer reverse
dependencies at this time, so rename it.  There is already an open pull
request upstream to do exactly that, so reuse parts of it.  That said,
since we can simply patch reverse dependencies, we do not need
the compatibility layer (and probably do not want it, as it could yield
confusing errors if the wrong package is installed).

Bug: https://github.com/pypa/packaging-problems/issues/818
Pull-Request: https://github.com/Kludex/python-multipart/pull/166
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../files/python-multipart-0.0.12-rename.patch     | 54 ++++++++++++++++++++++
 .../python-multipart-0.0.12-r100.ebuild            | 47 +++++++++++++++++++
 2 files changed, 101 insertions(+)

diff --git a/dev-python/python-multipart/files/python-multipart-0.0.12-rename.patch b/dev-python/python-multipart/files/python-multipart-0.0.12-rename.patch
new file mode 100644
index 000000000000..cee51b2df1c8
--- /dev/null
+++ b/dev-python/python-multipart/files/python-multipart-0.0.12-rename.patch
@@ -0,0 +1,54 @@
+From d6e30eb0269fa04d4a16133bd94405f10240aeb0 Mon Sep 17 00:00:00 2001
+From: Henry Schreiner <henryschreineriii@gmail.com>
+Date: Fri, 11 Oct 2024 17:11:21 -0400
+Subject: [PATCH 1/2] refactor: rename to python_multipart
+
+Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
+
+diff --git a/pyproject.toml b/pyproject.toml
+index fb03f83..1a81077 100644
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -62,13 +65,10 @@ Changelog = "https://github.com/Kludex/python-multipart/blob/master/CHANGELOG.md
+ Source = "https://github.com/Kludex/python-multipart"
+ 
+ [tool.hatch.version]
+-path = "multipart/__init__.py"
+-
+-[tool.hatch.build.targets.wheel]
+-packages = ["multipart"]
++path = "python_multipart/__init__.py"
+ 
+ [tool.hatch.build.targets.sdist]
+-include = ["/multipart", "/tests", "CHANGELOG.md", "LICENSE.txt"]
++include = ["/python_multipart", "/tests", "CHANGELOG.md", "LICENSE.txt", "_python_multipart.pth", "_python_multipart_loader.py"]
+ 
+ [tool.mypy]
+ strict = true
+diff --git a/tests/test_multipart.py b/tests/test_multipart.py
+index b824f19..f5f8e7e 100644
+--- a/tests/test_multipart.py
++++ b/tests/test_multipart.py
+@@ -11,9 +11,9 @@
+ 
+ import yaml
+ 
+-from multipart.decoders import Base64Decoder, QuotedPrintableDecoder
+-from multipart.exceptions import DecodeError, FileError, FormParserError, MultipartParseError, QuerystringParseError
+-from multipart.multipart import (
++from python_multipart.decoders import Base64Decoder, QuotedPrintableDecoder
++from python_multipart.exceptions import DecodeError, FileError, FormParserError, MultipartParseError, QuerystringParseError
++from python_multipart.multipart import (
+     BaseParser,
+     Field,
+     File,
+@@ -31,7 +31,7 @@
+ if TYPE_CHECKING:
+     from typing import Any, Iterator, TypedDict
+ 
+-    from multipart.multipart import FieldProtocol, FileConfig, FileProtocol
++    from python_multipart.multipart import FieldProtocol, FileConfig, FileProtocol
+ 
+     class TestParams(TypedDict):
+         name: str
+

diff --git a/dev-python/python-multipart/python-multipart-0.0.12-r100.ebuild b/dev-python/python-multipart/python-multipart-0.0.12-r100.ebuild
new file mode 100644
index 000000000000..ea54218ea564
--- /dev/null
+++ b/dev-python/python-multipart/python-multipart-0.0.12-r100.ebuild
@@ -0,0 +1,47 @@
+# Copyright 2022-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=hatchling
+PYTHON_COMPAT=( pypy3 python3_{10..13} )
+
+inherit distutils-r1
+
+DESCRIPTION="A streaming multipart parser for Python"
+HOMEPAGE="
+	https://github.com/Kludex/python-multipart/
+	https://pypi.org/project/python-multipart/
+"
+SRC_URI="
+	https://github.com/Kludex/python-multipart/archive/${PV}.tar.gz
+		-> ${P}.gh.tar.gz
+"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+
+BDEPEND="
+	test? (
+		dev-python/pyyaml[${PYTHON_USEDEP}]
+	)
+"
+
+distutils_enable_tests pytest
+
+src_prepare() {
+	local PATCHES=(
+		# https://github.com/Kludex/python-multipart/pull/166
+		"${FILESDIR}/${P}-rename.patch"
+	)
+
+	distutils-r1_src_prepare
+
+	mv multipart python_multipart || die
+}
+
+python_test() {
+	local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+	epytest
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-19  8:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-21 11:44 [gentoo-commits] repo/gentoo:master commit in: dev-python/python-multipart/, dev-python/python-multipart/files/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2024-10-19  8:53 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox