summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-09-26 22:18:48 +0100
committerSam James <sam@gentoo.org>2022-09-26 22:19:29 +0100
commitdd8f1804d5781a492398d1cfa8a6f901a09c54cf (patch)
tree5354d97ac49ae99d10ac1b2259a50effb9e57ebe /dev-python/patiencediff
parentmedia-sound/openmpt123: Bump to 0.6.6, drop old 0.6.5 (diff)
downloadgentoo-dd8f1804d5781a492398d1cfa8a6f901a09c54cf.tar.gz
gentoo-dd8f1804d5781a492398d1cfa8a6f901a09c54cf.tar.bz2
gentoo-dd8f1804d5781a492398d1cfa8a6f901a09c54cf.zip
dev-python/patiencediff: backport clang 15 patch
Closes: https://bugs.gentoo.org/869995 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-python/patiencediff')
-rw-r--r--dev-python/patiencediff/files/patiencediff-0.2.3-wint-conversion.patch84
-rw-r--r--dev-python/patiencediff/patiencediff-0.2.3-r1.ebuild31
2 files changed, 115 insertions, 0 deletions
diff --git a/dev-python/patiencediff/files/patiencediff-0.2.3-wint-conversion.patch b/dev-python/patiencediff/files/patiencediff-0.2.3-wint-conversion.patch
new file mode 100644
index 000000000000..3a8fd9fc1293
--- /dev/null
+++ b/dev-python/patiencediff/files/patiencediff-0.2.3-wint-conversion.patch
@@ -0,0 +1,84 @@
+https://github.com/breezy-team/patiencediff/commit/24e26cd2929e01dc8ef47fb71b3b87536ad43947
+
+From 24e26cd2929e01dc8ef47fb71b3b87536ad43947 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Mon, 26 Sep 2022 21:49:47 +0100
+Subject: [PATCH] Use designated initialiser syntax for PyTypeObject
+
+Fixes build with Clang. Switch to the more readable designated
+initialiser syntax to avoid having to lookup member order.
+
+Before, Clang would complain:
+```
+clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -fPIC -I/usr/include/python3.10 -c patiencediff/_patiencediff_c.c -o build/temp.linux-x86_64-cpython-310/patiencediff/_patiencediff_c.o
+patiencediff/_patiencediff_c.c:1175:5: error: incompatible pointer to integer conversion initializing 'Py_ssize_t' (aka 'long') with an expression of type 'void *' [-Wint-conversion]
+ NULL, /* tp_print */
+ ^~~~
+/usr/include/wchar.h:46:14: note: expanded from macro 'NULL'
+ ^~~~~~~~~~
+```
+
+This is because some of PyTypeObject's members are actually
+Py_ssize_t so chucking a NULL in looks like a codesmell to Clang.
+
+See https://docs.python.org/3/c-api/typeobj.html#quick-reference
+and https://docs.python.org/3/c-api/typeobj.html#examples.
+
+Bug: https://bugs.gentoo.org/869995
+Closes: https://github.com/breezy-team/patiencediff/issues/12
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/patiencediff/_patiencediff_c.c
++++ b/patiencediff/_patiencediff_c.c
+@@ -1168,44 +1168,13 @@ static char PatienceSequenceMatcher_doc[] =
+
+ static PyTypeObject PatienceSequenceMatcherType = {
+ PyVarObject_HEAD_INIT(NULL, 0)
+- "PatienceSequenceMatcher", /* tp_name */
+- sizeof(PatienceSequenceMatcher), /* tp_basicsize */
+- 0, /* tp_itemsize */
+- (destructor)PatienceSequenceMatcher_dealloc, /* tp_dealloc */
+- NULL, /* tp_print */
+- NULL, /* tp_getattr */
+- NULL, /* tp_setattr */
+- NULL, /* tp_compare */
+- NULL, /* tp_repr */
+- NULL, /* tp_as_number */
+- NULL, /* tp_as_sequence */
+- NULL, /* tp_as_mapping */
+- NULL, /* tp_hash */
+- NULL, /* tp_call */
+- NULL, /* tp_str */
+- NULL, /* tp_getattro */
+- NULL, /* tp_setattro */
+- NULL, /* tp_as_buffer */
+- Py_TPFLAGS_DEFAULT, /* tp_flags */
+- PatienceSequenceMatcher_doc, /* tp_doc */
+- NULL, /* tp_traverse */
+- NULL, /* tp_clear */
+- NULL, /* tp_richcompare */
+- 0, /* tp_weaklistoffset */
+- NULL, /* tp_iter */
+- NULL, /* tp_iternext */
+- PatienceSequenceMatcher_methods, /* tp_methods */
+- NULL, /* tp_members */
+- NULL, /* tp_getset */
+- NULL, /* tp_base */
+- NULL, /* tp_dict */
+- NULL, /* tp_descr_get */
+- NULL, /* tp_descr_set */
+- 0, /* tp_dictoffset */
+- NULL, /* tp_init */
+- NULL, /* tp_alloc */
+- PatienceSequenceMatcher_new, /* NULL */
+- NULL, /* tp_free */
++ .tp_name = "PatienceSequenceMatcher",
++ .tp_basicsize = sizeof(PatienceSequenceMatcher),
++ .tp_dealloc = (destructor)PatienceSequenceMatcher_dealloc,
++ .tp_flags = Py_TPFLAGS_DEFAULT,
++ .tp_doc = PatienceSequenceMatcher_doc,
++ .tp_methods = PatienceSequenceMatcher_methods,
++ .tp_new = PatienceSequenceMatcher_new,
+ };
+
+
+
diff --git a/dev-python/patiencediff/patiencediff-0.2.3-r1.ebuild b/dev-python/patiencediff/patiencediff-0.2.3-r1.ebuild
new file mode 100644
index 000000000000..71db75366bb9
--- /dev/null
+++ b/dev-python/patiencediff/patiencediff-0.2.3-r1.ebuild
@@ -0,0 +1,31 @@
+# Copyright 2021-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{8..11} pypy3 )
+
+inherit distutils-r1
+
+DESCRIPTION="Python implementation of the patiencediff algorithm"
+HOMEPAGE="
+ https://github.com/breezy-team/patiencediff/
+ https://pypi.org/project/patiencediff/
+"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-wint-conversion.patch
+)
+
+distutils_enable_tests unittest
+
+python_test() {
+ cd "${BUILD_DIR}/install$(python_get_sitedir)" || die
+ eunittest
+}