[packages/python3-pygame] - python-pygame.spec updated to 2.6.1 for python 3.6+; enabled apidocs

qboosh qboosh at pld-linux.org
Sat Oct 5 09:37:05 CEST 2024


commit 1931a9ec63dac301be8d6e68faea36ce16f05dcd
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sat Oct 5 08:26:13 2024 +0200

    - python-pygame.spec updated to 2.6.1 for python 3.6+; enabled apidocs

 pygame-portmidi.patch                     |  22 ------
 pygame-py2-types.patch                    |  33 ---------
 python-pygame.spec => python3-pygame.spec | 107 +++++++++++++++---------------
 x32.patch                                 |  48 +++++++-------
 4 files changed, 77 insertions(+), 133 deletions(-)
---
diff --git a/python-pygame.spec b/python3-pygame.spec
similarity index 58%
rename from python-pygame.spec
rename to python3-pygame.spec
index 56057b2..6d8104b 100644
--- a/python-pygame.spec
+++ b/python3-pygame.spec
@@ -1,50 +1,40 @@
 #
 # Conditional build:
-%bcond_with	apidocs	# Sphinx documentation (encoding errors as of 1.9.6 / Sphinx 1.8)
-%bcond_with	sdl1	# SDL 1.2 instead of 2.0
+%bcond_without	apidocs	# Sphinx documentation
 
 %define		module	pygame
 
 Summary:	Python modules designed for writing games
 Summary(pl.UTF-8):	Moduły Pythona dla piszących gry
-Name:		python-%{module}
-# keep 2.0.x here for python2 support
-Version:	2.0.3
+Name:		python3-%{module}
+Version:	2.6.1
 Release:	1
 License:	LGPL v2.1+
 Group:		Libraries/Python
 Source0:	https://files.pythonhosted.org/packages/source/p/pygame/pygame-%{version}.tar.gz
-# Source0-md5:	04e082d216b3b771b8d52769597b2fb2
-Patch0:		pygame-py2-types.patch
-Patch1:		pygame-portmidi.patch
+# Source0-md5:	cb6bf42a449b0bb1f53c534bcbcc220c
 Patch2:		x32.patch
 URL:		https://www.pygame.org/
-%if %{with sdl1}
-BuildRequires:	SDL-devel
-BuildRequires:	SDL_image-devel
-BuildRequires:	SDL_mixer-devel
-%else
 BuildRequires:	SDL2-devel >= 2.0
 BuildRequires:	SDL2_image-devel >= 2.0
 BuildRequires:	SDL2_mixer-devel >= 2.0
-%endif
 BuildRequires:	SDL_ttf-devel >= 2.0
 BuildRequires:	freetype-devel >= 2.0
 BuildRequires:	libjpeg-devel
 BuildRequires:	libpng-devel
 BuildRequires:	portmidi-devel >= 217
-BuildRequires:	python-devel >= 1:2.7
-BuildRequires:	python-modules >= 1:2.7
-BuildRequires:	python-numpy-devel
+BuildRequires:	python3-devel >= 1:3.6
+BuildRequires:	python3-modules >= 1:3.6
+BuildRequires:	python3-numpy-devel
 BuildRequires:	rpm-build >= 4.6
 BuildRequires:	rpm-pythonprov
 BuildRequires:	rpmbuild(macros) >= 1.714
 BuildRequires:	sed >= 4.0
 %if %{with apidocs}
-BuildRequires:	sphinx-pdg-2
+BuildRequires:	sphinx-pdg-3
 %endif
 BuildRequires:	xorg-lib-libX11-devel
-Requires:	python-modules >= 1:2.7
+Requires:	python3-modules >= 1:3.6
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -74,6 +64,18 @@ C header files for pygame modules.
 %description devel -l pl.UTF-8
 Pliki nagłówkowe języka C modułów pygame.
 
+%package apidocs
+Summary:	API documentation for Python pygame modules
+Summary(pl.UTF-8):	Dokumentacja API modułów Pythona pygame
+Group:		Documentation
+BuildArch:	noarch
+
+%description apidocs
+API documentation for Python pygame modules.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API modułów Pythona pygame.
+
 %package examples
 Summary:	Examples for Python pygame modules
 Summary(pl.UTF-8):	Przykłady do modułów Pythona pygame
@@ -89,40 +91,29 @@ Przykłady do modułów Pythona pygame.
 
 %prep
 %setup -q -n %{module}-%{version}
-%patch0 -p1
-%patch1 -p1
 %patch2 -p1
 
-# missing file, required for py2
-touch docs/reST/ext/__init__.py
-
-# encoding marker required for py2
-%{__sed} -i -e '1i # -*- coding: utf-8 -*-' \
-	docs/reST/ext/boilerplate.py
-
 %build
 export PORTMIDI_INC_PORTTIME=1
-%py_build \
-	%{?with_sdl1:-sdl1}
+CFLAGS="%{rpmcflags} -DPG_COMPILE_SSE4_2=0"
+%py3_build
 
 %if %{with apidocs}
-LC_ALL=C.UTF-8 \
-PYTHONIOENCODING=utf-8 \
-sphinx-build-2 -b html docs/reST docs/_build/html
+sphinx-build-3 -b html docs/reST docs/_build/html
 %endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
 
-%py_install
+%py3_install
 
 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
 
-%py_postclean
-%{__rm} -r $RPM_BUILD_ROOT%{py_sitedir}/%{module}/{docs,examples,tests}
-%{__rm} $RPM_BUILD_ROOT%{py_sitedir}/%{module}/pygame.ico
-%{__rm} $RPM_BUILD_ROOT%{py_sitedir}/%{module}/pygame_icon.*
+%{__rm} -r $RPM_BUILD_ROOT%{py3_sitedir}/%{module}/{docs,examples,tests}
+%{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/%{module}/pygame.ico
+%{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/%{module}/pygame_icon.*
+%{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/%{module}/pygame_icon_mac.*
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -130,25 +121,33 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(644,root,root,755)
 %doc README.rst
-%dir %{py_sitedir}/%{module}
-%{py_sitedir}/%{module}/*.ttf
-%attr(755,root,root) %{py_sitedir}/%{module}/*.so
-%{py_sitedir}/%{module}/*.py[cio]
-%{py_sitedir}/%{module}/py.typed
-%dir %{py_sitedir}/%{module}/__pyinstaller
-%{py_sitedir}/%{module}/__pyinstaller/*.py[co]
-%dir %{py_sitedir}/%{module}/_sdl2
-%if %{without sdl1}
-%attr(755,root,root) %{py_sitedir}/%{module}/_sdl2/*.so
-%endif
-%{py_sitedir}/%{module}/_sdl2/*.py[cio]
-%dir %{py_sitedir}/%{module}/threads
-%{py_sitedir}/%{module}/threads/*.py[co]
-%{py_sitedir}/pygame-%{version}-py*.egg-info
+%dir %{py3_sitedir}/%{module}
+%{py3_sitedir}/%{module}/*.ttf
+%attr(755,root,root) %{py3_sitedir}/%{module}/*.so
+%{py3_sitedir}/%{module}/*.py
+%{py3_sitedir}/%{module}/*.pyi
+%{py3_sitedir}/%{module}/py.typed
+%{py3_sitedir}/%{module}/__pycache__
+%dir %{py3_sitedir}/%{module}/__pyinstaller
+%{py3_sitedir}/%{module}/__pyinstaller/*.py
+%{py3_sitedir}/%{module}/__pyinstaller/__pycache__
+%dir %{py3_sitedir}/%{module}/_sdl2
+%attr(755,root,root) %{py3_sitedir}/%{module}/_sdl2/*.so
+%{py3_sitedir}/%{module}/_sdl2/*.py
+%{py3_sitedir}/%{module}/_sdl2/*.pyi
+%{py3_sitedir}/%{module}/_sdl2/__pycache__
+%dir %{py3_sitedir}/%{module}/threads
+%{py3_sitedir}/%{module}/threads/*.py
+%{py3_sitedir}/%{module}/threads/__pycache__
+%{py3_sitedir}/pygame-%{version}-py*.egg-info
 
 %files devel
 %defattr(644,root,root,755)
-%{py_incdir}/%{module}
+%{py3_incdir}/%{module}
+
+%files apidocs
+%defattr(644,root,root,755)
+%doc docs/_build/html/{_images,_static,c_api,ref,tut,*.html,*.js}
 
 %files examples
 %defattr(644,root,root,755)
diff --git a/pygame-portmidi.patch b/pygame-portmidi.patch
deleted file mode 100644
index d91de6f..0000000
--- a/pygame-portmidi.patch
+++ /dev/null
@@ -1,22 +0,0 @@
---- pygame-2.0.3/src_c/cython/pygame/pypm.pyx.orig	2021-10-31 16:49:23.000000000 +0100
-+++ pygame-2.0.3/src_c/cython/pygame/pypm.pyx	2024-10-04 21:47:29.565174454 +0200
-@@ -542,7 +542,7 @@ cdef class Input:
-         self.debug = 0
- 
-         err = Pm_OpenInput(&(self.midi), input_device, NULL, buffersize,
--                           &Pt_Time, NULL)
-+                           <PmTimeProcPtr>&Pt_Time, NULL)
-         if err < 0:
-             raise Exception(Pm_GetErrorText(err))
- 
---- pygame-2.0.3/src_c/pypm.c.orig	2021-10-31 16:49:23.000000000 +0100
-+++ pygame-2.0.3/src_c/pypm.c	2024-10-04 21:47:07.065045505 +0200
-@@ -4662,7 +4662,7 @@ static int __pyx_pf_6pygame_4pypm_5Input
-  *         if err < 0:
-  *             raise Exception(Pm_GetErrorText(err))
-  */
--  __pyx_v_err = Pm_OpenInput((&__pyx_v_self->midi), __pyx_t_2, NULL, __pyx_t_3, (&Pt_Time), NULL);
-+  __pyx_v_err = Pm_OpenInput((&__pyx_v_self->midi), __pyx_t_2, NULL, __pyx_t_3, (PmTimeProcPtr)(&Pt_Time), NULL);
- 
-   /* "pygame/pypm.pyx":546
-  *         err = Pm_OpenInput(&(self.midi), input_device, NULL, buffersize,
diff --git a/pygame-py2-types.patch b/pygame-py2-types.patch
deleted file mode 100644
index 1e9250d..0000000
--- a/pygame-py2-types.patch
+++ /dev/null
@@ -1,33 +0,0 @@
---- pygame-2.0.3/src_c/font.c.orig	2021-10-31 16:49:23.000000000 +0100
-+++ pygame-2.0.3/src_c/font.c	2024-10-04 06:16:51.713822968 +0200
-@@ -745,7 +745,7 @@ font_dealloc(PyFontObject *self)
-         if (self->ttf_init_generation != current_ttf_generation) {
-             // Since TTF_Font is a private structure
-             // it's impossible to access face field in a common way.
--            int** face_pp = font;
-+            int** face_pp = (int**)font;
-             *face_pp = NULL;
-         }
-         TTF_CloseFont(font);
---- pygame-2.0.3/src_c/_pygame.h.orig	2021-10-31 16:49:23.000000000 +0100
-+++ pygame-2.0.3/src_c/_pygame.h	2024-10-04 06:17:00.351563606 +0200
-@@ -250,7 +250,7 @@ typedef enum {
- #error No support for PEP 3118/Py_TPFLAGS_HAVE_NEWBUFFER. Please use a supported Python version.
- #endif */
- 
--#define RAISE(x, y) (PyErr_SetString((x), (y)), (PyObject *)NULL)
-+#define RAISE(x, y) (PyErr_SetString((x), (y)), NULL)
- #define DEL_ATTR_NOT_SUPPORTED_CHECK(name, value)           \
-     do {                                                    \
-        if (!value) {                                        \
---- pygame-2.0.3/src_c/transform.c.orig	2021-10-31 16:49:23.000000000 +0100
-+++ pygame-2.0.3/src_c/transform.c	2024-10-04 06:24:54.917312357 +0200
-@@ -668,7 +668,7 @@ surf_rotate(PyObject *self, PyObject *ar
-     surf = pgSurface_AsSurface(surfobj);
-     if (surf->w < 1 || surf->h < 1) {
-         Py_INCREF(surfobj);
--        return surfobj;
-+        return (PyObject *)surfobj;
-     }
- 
-     if (surf->format->BytesPerPixel == 0 || surf->format->BytesPerPixel > 4)
diff --git a/x32.patch b/x32.patch
index 7650f74..afc7bc7 100644
--- a/x32.patch
+++ b/x32.patch
@@ -1,30 +1,30 @@
---- pygame-2.0.3/buildconfig/config_unix.py.orig	2024-10-03 22:31:41.481965431 +0200
-+++ pygame-2.0.3/buildconfig/config_unix.py	2024-10-04 06:25:17.535875741 +0200
-@@ -136,14 +136,10 @@ def main(sdl2=False):
+--- pygame-2.6.1/buildconfig/config_unix.py.orig	2024-10-05 07:49:29.653718456 +0200
++++ pygame-2.6.1/buildconfig/config_unix.py	2024-10-05 08:20:15.307053028 +0200
+@@ -141,7 +141,7 @@ def main(auto_config=False):
+ 
      #these get prefixes with '/usr' and '/usr/local' or the $LOCALBASE
-     if sdl2:
-         origincdirs = ['/include', '/include/SDL2']
--        origlibdirs = ['/lib', '/lib64', '/X11R6/lib',
--                       '/lib/i386-linux-gnu', '/lib/x86_64-linux-gnu',
--                       '/lib/arm-linux-gnueabihf/', '/lib/aarch64-linux-gnu/']
--
-+        origlibdirs = ['/lib', '/lib64', '/libx32']
-     else:
-         origincdirs = ['/include', '/include/SDL', '/include/SDL']
--        origlibdirs = ['/lib', '/lib64', '/X11R6/lib', '/lib/arm-linux-gnueabihf/',
--                       '/lib/aarch64-linux-gnu/']
-+        origlibdirs = ['/lib', '/lib64', '/libx32']
-     if 'ORIGLIBDIRS' in os.environ and os.environ['ORIGLIBDIRS'] != "":
-         origlibdirs = os.environ['ORIGLIBDIRS'].split(":")
+     origincdirs = ['/include', '/include/SDL2']
+-    origlibdirs = ['/lib', '/lib64', '/X11R6/lib']
++    origlibdirs = ['/lib', '/lib64', '/libx32']
+ 
+     # If we are on a debian based system, we also need to handle
+     # /lib/<multiarch-tuple>
+@@ -168,7 +168,6 @@ def main(auto_config=False):
  
---- pygame-1.9.6/src_c/scale_mmx.c.orig	2019-04-25 08:14:17.000000000 +0200
-+++ pygame-1.9.6/src_c/scale_mmx.c	2024-09-26 20:21:01.509926690 +0200
+         if stdout:
+             # found what we were looking for
+-            origlibdirs.append(f"/lib/{stdout}")
+             break
+ 
+     if 'ORIGLIBDIRS' in os.environ and os.environ['ORIGLIBDIRS'] != "":
+--- pygame-2.6.1/src_c/scale_mmx.c.orig	2024-10-05 07:49:29.657051772 +0200
++++ pygame-2.6.1/src_c/scale_mmx.c	2024-10-05 08:20:55.180170350 +0200
 @@ -29,7 +29,7 @@
   * Including source code like this may be frowned upon by some,
   * but the alternative is ungainly conditionally compiled code.
   */
--#   if defined(__x86_64__)
-+#   if defined(__x86_64__) && defined(__LP64__)
- #       include "scale_mmx64.c"
- #   elif defined(__i386__)
- #       include "scale_mmx32.c"
+-#if defined(__x86_64__)
++#if defined(__x86_64__) && defined(__LP64__)
+ #include "scale_mmx64.c"
+ #elif defined(__i386__)
+ #include "scale_mmx32.c"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python3-pygame.git/commitdiff/1931a9ec63dac301be8d6e68faea36ce16f05dcd



More information about the pld-cvs-commit mailing list