From 94dd707d272879a8dfdd31d71113b1b7bba98366 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 17 Oct 2023 22:03:16 +0100 Subject: gentoo auto-resync : 17:10:2023 - 22:03:16 --- dev-python/pygame/Manifest | 3 + dev-python/pygame/files/pygame-2.5.2-error.patch | 121 +++++++++++++++++++++++ dev-python/pygame/pygame-2.5.2.ebuild | 101 +++++++++++++++++++ 3 files changed, 225 insertions(+) create mode 100644 dev-python/pygame/files/pygame-2.5.2-error.patch create mode 100644 dev-python/pygame/pygame-2.5.2.ebuild (limited to 'dev-python/pygame') diff --git a/dev-python/pygame/Manifest b/dev-python/pygame/Manifest index 9a8181bb65bb..d4b7d1e4c277 100644 --- a/dev-python/pygame/Manifest +++ b/dev-python/pygame/Manifest @@ -1,3 +1,6 @@ +AUX pygame-2.5.2-error.patch 3723 BLAKE2B 3a3196e5eb4fa24f7246c05f016d78a94b40d620ec3d60ad48342ffb1d5c6d90e87dcb37d42f9b4987286645c92862377a1eb314bdda86a568fb4700438123c5 SHA512 63495f55322499a80e46c284a4cda52014f071652608dcbe7c45ab164ae5c1c49588da6c8bc7e61fb63852ef2aa3ca9ab22a61431b8ae932d5f811622cc484c1 DIST pygame-2.5.1.gh.tar.gz 6854761 BLAKE2B e137f73a3bb718213ef92e938ed1b065f5568d7dd2ade6edd973bc55d06425874da0e89e3c102fad39adac25f977ac97025a0c59099702cfabeffd0d3b8f109f SHA512 d7aceb2bc6e40c5dc2d7a19fdc7af18abf021b79dd98b859975f99ec10895e1b09e11fbf17fd6ab925d3aa6c64e5b3dd56c0d857ecacc67303d92fc0efb2630c +DIST pygame-2.5.2.gh.tar.gz 5970857 BLAKE2B 523874926a8fd868f5674ed2997a44decb928fcfe246d551249ed7320a0e908ce46d00f459d187726edf74a4c1038cd56821f6466559fb7d24aa75d16769cbfe SHA512 b54e9b80951c8a9e75666621aafc26874c6dbdab27330146f7217346c76be5627a5464a0102a5968eca0dbd7cced4b2143cd2ff1b6227e3e17e5634854b27f19 EBUILD pygame-2.5.1.ebuild 1926 BLAKE2B f08e24fb19733c2272d19122702b553b7509c852719a6ef852e76a31f3e10756effd36ae709ae0e44a820645471e1f0be0973503237ab05e197dc5a950cf4e22 SHA512 09f4845aaafb9026bf0f8f5dfbee9133b610f1ee0e8f046c1380258ae82cf9d463e221a96739e0110e4f68c44ef624771d0d0db6e7a069d6b5961c588a01b1e1 +EBUILD pygame-2.5.2.ebuild 2226 BLAKE2B 697ad49a3919641abb582503030b0ee4e67bdcc50ca252c657ea5ee6e489a3fd40ba0830da6b7fe6bf108dbf62e34d033c07c8ca4e71f6cdd1d8b124ca0c816e SHA512 599ade460dbf0cf5ca2e1bfe85fd4b284cda55c6beeefaed5e8b088436ea97b7bf64c6eacc1627837d7078714c6a0c5dca7067a2bb5ec3855885b8e500a84eb5 MISC metadata.xml 363 BLAKE2B a942b91aded22ec850a7b075703ce4037af9f0a61155717ac455f7d2b7779cb6f5f953b2ad8d61d7cc5254307951a20dd3edb9853e21d907e1999f7570a6b821 SHA512 15403754c9b13f9b2d8c5e7615ae0ca9359b5079e22eb5a7049424e414ebbdd8a06f6324c31594636324414e35ca34bec977b7dded9f9ea14027497b5097b060 diff --git a/dev-python/pygame/files/pygame-2.5.2-error.patch b/dev-python/pygame/files/pygame-2.5.2-error.patch new file mode 100644 index 000000000000..9f2800e29e70 --- /dev/null +++ b/dev-python/pygame/files/pygame-2.5.2-error.patch @@ -0,0 +1,121 @@ +From bbed8d293483fa7bd7322f5976641dfe86bf6367 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ren=C3=A9=20Dudfield?= +Date: Sat, 7 Oct 2023 12:05:45 +0200 +Subject: [PATCH 1/2] base: Clean up some error messaging + +--- + src_c/base.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src_c/base.c b/src_c/base.c +index 1f12a63451..d32c17bdc5 100644 +--- a/src_c/base.c ++++ b/src_c/base.c +@@ -309,11 +309,13 @@ pg_mod_autoquit(const char *modname) + + funcobj = PyObject_GetAttrString(module, "_internal_mod_quit"); + ++ if (PyErr_Occurred()) ++ PyErr_Clear(); ++ + /* If we could not load _internal_mod_quit, load quit function */ + if (!funcobj) + funcobj = PyObject_GetAttrString(module, "quit"); + +- /* Silence errors */ + if (PyErr_Occurred()) + PyErr_Clear(); + +@@ -322,7 +324,6 @@ pg_mod_autoquit(const char *modname) + Py_XDECREF(temp); + } + +- /* Silence errors */ + if (PyErr_Occurred()) + PyErr_Clear(); + + +From d8fae59ff0f3a02fe159cc302c891177af97a41f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ren=C3=A9=20Dudfield?= +Date: Sat, 7 Oct 2023 12:05:58 +0200 +Subject: [PATCH 2/2] pixelcopy: Clean up some error messaging + +--- + src_c/pixelcopy.c | 27 +++++++++++++++++++++++++++ + 1 file changed, 27 insertions(+) + +diff --git a/src_c/pixelcopy.c b/src_c/pixelcopy.c +index 923072dde8..1d1eaf3267 100644 +--- a/src_c/pixelcopy.c ++++ b/src_c/pixelcopy.c +@@ -767,6 +767,9 @@ surface_to_array(PyObject *self, PyObject *args, PyObject *kwds) + Uint8 opaque = 255; + Uint8 clear = 0; + SDL_Surface *surf; ++ PyObject *type = NULL; ++ PyObject *value = NULL; ++ PyObject *traceback = NULL; + char *keywords[] = {"array", "surface", "kind", "opaque", "clear", 0}; + + if (!PyArg_ParseTupleAndKeywords( +@@ -794,8 +797,16 @@ surface_to_array(PyObject *self, PyObject *args, PyObject *kwds) + if (view_p->ndim == 2) { + if (view_kind == VIEWKIND_RGB) { + if (_copy_mapped(view_p, surf)) { ++ if (PyErr_Occurred()) { ++ PyErr_Fetch(&type, &value, &traceback); ++ PyErr_Clear(); ++ } ++ + pgBuffer_Release(&pg_view); + pgSurface_Unlock(surfobj); ++ if (type) { ++ PyErr_Restore(type, value, traceback); ++ } + return 0; + } + } +@@ -876,6 +887,8 @@ map_array(PyObject *self, PyObject *args) + _pc_pixel_t pixel = {0}; + int pix_bytesize; + Py_ssize_t i; ++ PyObject *type = NULL; ++ PyObject *value, *traceback; + + if (!PyArg_ParseTuple(args, "OOO!", &tar_array, &src_array, + &pgSurface_Type, &format_surf)) { +@@ -889,6 +902,11 @@ map_array(PyObject *self, PyObject *args) + /* Determine array shapes and check validity + */ + if (pgObject_GetBuffer(tar_array, &tar_pg_view, PyBUF_RECORDS)) { ++ if (PyErr_Occurred()) { ++ PyErr_Fetch(&type, &value, &traceback); ++ PyErr_Clear(); ++ } ++ + goto fail; + } + is_tar_alloc = 1; +@@ -912,6 +930,10 @@ map_array(PyObject *self, PyObject *args) + goto fail; + } + if (pgObject_GetBuffer(src_array, &src_pg_view, PyBUF_RECORDS_RO)) { ++ if (PyErr_Occurred()) { ++ PyErr_Fetch(&type, &value, &traceback); ++ PyErr_Clear(); ++ } + goto fail; + } + is_src_alloc = 1; +@@ -1134,6 +1156,11 @@ map_array(PyObject *self, PyObject *args) + pgBuffer_Release(&tar_pg_view); + } + pgSurface_Unlock(format_surf); ++ ++ if (type != NULL) { ++ PyErr_Restore(type, value, traceback); ++ } ++ + return 0; + } + diff --git a/dev-python/pygame/pygame-2.5.2.ebuild b/dev-python/pygame/pygame-2.5.2.ebuild new file mode 100644 index 000000000000..6d89ed769186 --- /dev/null +++ b/dev-python/pygame/pygame-2.5.2.ebuild @@ -0,0 +1,101 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_EXT=1 +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{10..12} pypy3 ) + +inherit distutils-r1 + +DESCRIPTION="Python bindings for SDL multimedia library" +HOMEPAGE=" + https://www.pygame.org/ + https://github.com/pygame/pygame/ + https://pypi.org/project/pygame/ +" +SRC_URI=" + https://github.com/pygame/pygame/archive/${PV}.tar.gz + -> ${P}.gh.tar.gz +" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~sparc ~x86" +IUSE="examples opengl test X" +RESTRICT="!test? ( test )" + +RDEPEND=" + dev-python/numpy[${PYTHON_USEDEP}] + media-libs/freetype + media-libs/libjpeg-turbo:= + media-libs/libpng:= + media-libs/portmidi + media-libs/sdl2-image + media-libs/sdl2-mixer + media-libs/sdl2-ttf + X? ( media-libs/libsdl2[opengl?,threads,video,X] ) + !X? ( media-libs/libsdl2[threads] ) +" +DEPEND=" + ${RDEPEND} + test? ( + media-libs/sdl2-image[gif,jpeg,png,tiff,webp] + media-libs/sdl2-mixer[mp3,vorbis,wav] + ) +" +# fontconfig used for fc-list +RDEPEND+=" + media-libs/fontconfig +" +# util-linux provides script +BDEPEND=" + dev-python/cython[${PYTHON_USEDEP}] + test? ( + media-libs/fontconfig + sys-apps/util-linux + ) +" + +src_prepare() { + local PATCHES=( + # https://github.com/pygame/pygame/pull/4035 + "${FILESDIR}/${P}-error.patch" + ) + + # some numpy-related crash (not a regression) + # https://github.com/pygame/pygame/issues/4049 + sed -e 's:import numpy:raise ImportError(""):' \ + -i test/pixelcopy_test.py || die + + distutils-r1_src_prepare +} + +python_configure() { + PORTMIDI_INC_PORTTIME=1 LOCALBASE="${EPREFIX}/usr" \ + "${EPYTHON}" "${S}"/buildconfig/config.py || die +} + +python_configure_all() { + find src_c/cython -name '*.pyx' -exec touch {} + || die + "${EPYTHON}" setup.py cython_only || die +} + +python_test() { + local -x SDL_VIDEODRIVER=dummy + local -x SDL_AUDIODRIVER=disk + script -eqc "${EPYTHON} -m pygame.tests -v" || die +} + +python_install() { + distutils-r1_python_install + + # https://bugs.gentoo.org/497720 + rm -fr "${D}$(python_get_sitedir)"/pygame/{docs,examples} || die +} + +python_install_all() { + distutils-r1_python_install_all + use examples && dodoc -r examples +} -- cgit v1.2.3