[bug#60153] gnu: python-pygame: Update to 2.1.2.

Message ID 3e37f988-a3ec-ccce-033e-1807fe7859b9@disroot.org
State New
Headers
Series [bug#60153] gnu: python-pygame: Update to 2.1.2. |

Commit Message

Adam Faiz Dec. 17, 2022, 10:01 a.m. UTC
From 2641ac309552016f5095b8f50259cd92b760ebad Mon Sep 17 00:00:00 2001
From: AwesomeAdam54321 <adam.faiz@disroot.org>
Date: Sat, 17 Dec 2022 17:37:21 +0800
Subject: [PATCH] gnu: python-pygame: Update to 2.1.2.

* gnu/packages/game-development.scm (python-pygame): Update to 2.1.2.
[inputs]: Use the new style.
[description]: Re-indent.
---
  gnu/packages/game-development.scm | 119 +++++++++++++-----------------
  1 file changed, 51 insertions(+), 68 deletions(-)

      (home-page "https://www.pygame.org")
      (synopsis "SDL wrapper for Python")
      (description "Pygame is a set of Python modules designed for 
writing games.
-Pygame adds functionality on top of the excellent SDL library. This 
allows you
+  Pygame adds functionality on top of the excellent SDL library.  This 
allows you
  to create fully featured games and multimedia programs in the python 
language.")
      (license (list license:bsd-2
                     ;; python numeric license as listed by Debian looks 
like
  

Comments

Liliana Marie Prikler Dec. 17, 2022, 10:52 a.m. UTC | #1
Am Samstag, dem 17.12.2022 um 18:06 +0800 schrieb Adam Faiz:
> * gnu/packages/game-development.scm (python-pygame): Update to 2.1.2.
Since this is a major bump, did you check whether dependant packages
still build?
> [inputs]: Use the new style.
I'd split the style adjustments into a separate commit.  Also note,
that #:phases needs similar treatment w.r.t. using the newer API.
> [description]: Re-indent.
IMHO that one's noise generated by guix style.
> ---
>   gnu/packages/game-development.scm | 119 +++++++++++++--------------
> ---
>   1 file changed, 51 insertions(+), 68 deletions(-)
> 
> diff --git a/gnu/packages/game-development.scm 
> b/gnu/packages/game-development.scm
> index 4a0435045b..c3d8d9a8a9 100644
> --- a/gnu/packages/game-development.scm
> +++ b/gnu/packages/game-development.scm
> @@ -1194,92 +1194,75 @@ (define-public quesoglc
>   (define-public python-pygame
>     (package
>       (name "python-pygame")
> -    (version "1.9.4")
> +    (version "2.1.2")
>       (source (origin
>                 (method url-fetch)
>                 (uri (pypi-uri "pygame" version))
>                 (sha256
>                  (base32
> -               
> "1dn0nb86jl7yr8709cncxdr0yrmviqakw7zx3g8jbbwrr60if3bh"))))
> +               
> "0g6j79naab7583kymf1bgxc5l5c9h5laq887rmvh8vw8iyifrl6n"))
> +              (modules '((guix build utils)))
> +              ;; Fix the configure script to allow passing the 
> dependencies as
> +              ;; environment variables.
> +              (snippet
> +               #~(begin
> +                   (substitute* "buildconfig/config_unix.py"
> +                     (("localbase.d") "d")
> +                     (("origincdirs = .*/include.*")
> +                      "origincdirs = 
> os.environ['ORIGINCDIRS'].split(\":\")\n"))))))
Can't we make it so that the normal GCC search paths suffice?
Also note the value of fill-column at 80 (or 79?).


Cheers
  
Adam Faiz Dec. 18, 2022, 2:15 p.m. UTC | #2
On 12/17/22 18:52, Liliana Marie Prikler wrote:
> Am Samstag, dem 17.12.2022 um 18:06 +0800 schrieb Adam Faiz:
>> * gnu/packages/game-development.scm (python-pygame): Update to 2.1.2.
> Since this is a major bump, did you check whether dependant packages
> still build?
The dependent packages build without issue. I built the packages listed 
in `./pre-inst-env guix refresh -l python-pygame`.

>> [inputs]: Use the new style.
> I'd split the style adjustments into a separate commit.  Also note,
> that #:phases needs similar treatment w.r.t. using the newer API.
Alright, I'll do the style adjustments in a separate patch. Most of what 
was in the #:phases that would have used the newer API is now 
unnecessary, so I've removed it.

>> [description]: Re-indent.
> IMHO that one's noise generated by guix style.
I don't think it hurts to change it.

>> +              ;; Fix the configure script to allow passing the
>> dependencies as
>> +              ;; environment variables.
>> +              (snippet
>> +               #~(begin
>> +                   (substitute* "buildconfig/config_unix.py"
>> +                     (("localbase.d") "d")
>> +                     (("origincdirs = .*/include.*")
>> +                      "origincdirs =
>> os.environ['ORIGINCDIRS'].split(\":\")\n"))))))
> Can't we make it so that the normal GCC search paths suffice?
The normal GCC search paths do work, so I've changed it to use those 
instead. I'll send the revised patches soon.

> Also note the value of fill-column at 80 (or 79?).
Is it a problem with how Icedove wraps the email? If so, I'm not sure 
how to change it.

> 
> 
> Cheers
  
Liliana Marie Prikler Dec. 18, 2022, 3:02 p.m. UTC | #3
Am Sonntag, dem 18.12.2022 um 22:15 +0800 schrieb Adam Faiz:
> > > [inputs]: Use the new style.
> > I'd split the style adjustments into a separate commit.  Also note,
> > that #:phases needs similar treatment w.r.t. using the newer API.
> Alright, I'll do the style adjustments in a separate patch. Most of
> what was in the #:phases that would have used the newer API is now 
> unnecessary, so I've removed it.
Nice.

> > > [description]: Re-indent.
> > IMHO that one's noise generated by guix style.
> I don't think it hurts to change it.
Fair enough, just saying.

> > > +              ;; Fix the configure script to allow passing the
> > > dependencies as
> > > +              ;; environment variables.
> > > +              (snippet
> > > +               #~(begin
> > > +                   (substitute* "buildconfig/config_unix.py"
> > > +                     (("localbase.d") "d")
> > > +                     (("origincdirs = .*/include.*")
> > > +                      "origincdirs =
> > > os.environ['ORIGINCDIRS'].split(\":\")\n"))))))
> > Can't we make it so that the normal GCC search paths suffice?
> The normal GCC search paths do work, so I've changed it to use those 
> instead. I'll send the revised patches soon.
Cool.

> > Also note the value of fill-column at 80 (or 79?).
> Is it a problem with how Icedove wraps the email? If so, I'm not sure
> how to change it.
No, it's a code style problem in general, i.e. you shouldn't make the
line so long that any mail client will have to wrap it anyway.  Since
that line definitely exceeded the limit, I wanted you to know.

Cheers
  
Liliana Marie Prikler Dec. 22, 2022, 9:09 p.m. UTC | #4
Hi Adam and everyone else reading.

For the sake of transparency, this is the series I plan on pushing on
December 31st to close this bug.  Obviously, I'll add proper sign-offs
before doing so ;)

Cheers

Adam Faiz (2):
  gnu: python-pygame: Update to 2.1.2.
  gnu: python-pygame: Use G-Expressions and new-style inputs.

Liliana Marie Prikler (1):
  gnu: python-pygame: Reword description.

 gnu/packages/game-development.scm | 120 +++++++++++-------------------
 1 file changed, 44 insertions(+), 76 deletions(-)
  
Liliana Marie Prikler Dec. 31, 2022, 7:34 a.m. UTC | #5
Am Donnerstag, dem 22.12.2022 um 22:09 +0100 schrieb Liliana Marie
Prikler:
> Hi Adam and everyone else reading.
> 
> For the sake of transparency, this is the series I plan on pushing on
> December 31st to close this bug.  Obviously, I'll add proper sign-
> offs before doing so ;)
> 
> Cheers
> 
> Adam Faiz (2):
>   gnu: python-pygame: Update to 2.1.2.
>   gnu: python-pygame: Use G-Expressions and new-style inputs.
> 
> Liliana Marie Prikler (1):
>   gnu: python-pygame: Reword description.
> 
>  gnu/packages/game-development.scm | 120 +++++++++++-----------------
> --
>  1 file changed, 44 insertions(+), 76 deletions(-)
Pushed now.

Cheers
  

Patch

diff --git a/gnu/packages/game-development.scm 
b/gnu/packages/game-development.scm
index 4a0435045b..c3d8d9a8a9 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1194,92 +1194,75 @@  (define-public quesoglc
  (define-public python-pygame
    (package
      (name "python-pygame")
-    (version "1.9.4")
+    (version "2.1.2")
      (source (origin
                (method url-fetch)
                (uri (pypi-uri "pygame" version))
                (sha256
                 (base32
-                "1dn0nb86jl7yr8709cncxdr0yrmviqakw7zx3g8jbbwrr60if3bh"))))
+                "0g6j79naab7583kymf1bgxc5l5c9h5laq887rmvh8vw8iyifrl6n"))
+              (modules '((guix build utils)))
+              ;; Fix the configure script to allow passing the 
dependencies as
+              ;; environment variables.
+              (snippet
+               #~(begin
+                   (substitute* "buildconfig/config_unix.py"
+                     (("localbase.d") "d")
+                     (("origincdirs = .*/include.*")
+                      "origincdirs = 
os.environ['ORIGINCDIRS'].split(\":\")\n"))))))
      (build-system python-build-system)
      (arguments
       `(#:tests? #f                ; tests require pygame to be 
installed first
         #:phases
         (modify-phases %standard-phases
-         ;; Set the paths to the dependencies manually because
-         ;; the configure script does not allow passing them as
-         ;; parameters.  This also means we can skip the configure
-         ;; phase.
+         ;; Pass the dependencies to the configure script
+         ;; through environment variables.
           (add-before 'build 'set-library-paths
             (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((sdl-ref   (assoc-ref inputs "sdl"))
-                   (font-ref  (assoc-ref inputs "sdl-ttf"))
-                   (image-ref (assoc-ref inputs "sdl-image"))
-                   (mixer-ref (assoc-ref inputs "sdl-mixer"))
+             (let ((font-ref  (assoc-ref inputs "sdl2-ttf"))
+                   (image-ref (assoc-ref inputs "sdl2-image"))
+                   (mixer-ref (assoc-ref inputs "sdl2-mixer"))
                     (smpeg-ref (assoc-ref inputs "libsmpeg"))
                     (png-ref   (assoc-ref inputs "libpng"))
-                   (jpeg-ref  (assoc-ref inputs "libjpeg"))
-                   (freetype-ref (assoc-ref inputs "freetype"))
-                   (v4l-ref   (assoc-ref inputs "v4l-utils"))
-                   (out-ref   (assoc-ref outputs "out")))
-               (substitute* "Setup.in"
-                 (("SDL = -I/usr/include/SDL")
-                  (string-append "SDL = -I" sdl-ref "/include/SDL -I.")))
-               (substitute* "Setup.in"
-                 (("FONT = -lSDL_ttf")
-                  (string-append "FONT = -I" font-ref "/include/SDL -L"
-                                 font-ref "/lib -lSDL_ttf")))
-               (substitute* "Setup.in"
-                 (("IMAGE = -lSDL_image")
-                  (string-append "IMAGE = -I" image-ref "/include/SDL -L"
-                                 image-ref "/lib -lSDL_image")))
-               (substitute* "Setup.in"
-                 (("MIXER = -lSDL_mixer")
-                  (string-append "MIXER = -I" mixer-ref "/include/SDL -L"
-                                 mixer-ref "/lib -lSDL_mixer")))
-               (substitute* "Setup.in"
-                 (("SMPEG = -lsmpeg")
-                  (string-append "SMPEG = -I" smpeg-ref "/include/smpeg -L"
-                                 smpeg-ref "/lib -lsmpeg")))
-               (substitute* "Setup.in"
-                 (("PNG = -lpng")
-                  (string-append "PNG = -I" png-ref "/include -L"
-                                 png-ref "/lib -lpng")))
-               (substitute* "Setup.in"
-                 (("JPEG = -ljpeg")
-                  (string-append "JPEG = -I" jpeg-ref "/include -L"
-                                 jpeg-ref "/lib -ljpeg")))
-
-               (substitute* "Setup.in"
-                 (("FREETYPE = -lfreetype")
-                  (string-append "FREETYPE = -I" freetype-ref 
"/include/freetype2 -L"
-                                 freetype-ref "/lib -lfreetype")))
-
-               (substitute* "Setup.in"
-                 (("^pypm") "#pypm"))
-               ;; Create a path to a header file provided by v4l-utils.
-               (system* "mkdir" "linux")
-               (system* "ln" "--symbolic"
-                        (string-append v4l-ref 
"/include/libv4l1-videodev.h")
-                        "linux/videodev.h")
-               (system* "ln" "--symbolic" "Setup.in" "Setup")))))))
+                   (jpeg-ref  (assoc-ref inputs "libjpeg-turbo"))
+                   (libx11-ref (assoc-ref inputs "libx11"))
+                   (portmidi-ref (assoc-ref inputs "portmidi")))
+               (setenv "LOCALBASE" " ")
+               (setenv "ORIGLIBDIRS"
+                       (string-append
+                        font-ref "/lib:" image-ref "/lib:" image-ref 
"/lib:"
+                        mixer-ref "/lib:" smpeg-ref "/lib:" png-ref "/lib:"
+                        jpeg-ref "/lib:" libx11-ref "/lib:" 
portmidi-ref "/lib"))
+               (setenv "ORIGINCDIRS"
+                       (string-append
+                        font-ref "/include/SDL2:"
+                        image-ref "/include/SDL2:"
+                        image-ref "/include/SDL:"
+                        mixer-ref "/include/SDL2:"
+                        smpeg-ref "/include/smpeg:"
+                        png-ref "/include:"
+                        jpeg-ref "/include:"
+                        libx11-ref "/include/X11:"
+                        portmidi-ref "/include"))))))))
+    (native-inputs
+     (list pkg-config))
      (inputs
-     `(("freetype" ,freetype)
-       ("sdl" ,sdl)
-       ("sdl-image" ,sdl-image)
-       ("sdl-mixer" ,sdl-mixer)
-       ("sdl-ttf" ,sdl-ttf)
-       ("sdl-gfx" ,sdl-gfx)
-       ("libjpeg" ,libjpeg-turbo)
-       ("libpng" ,libpng)
-       ("libX11" ,libx11)
-       ("libsmpeg" ,libsmpeg)
-       ("portmidi" ,portmidi)
-       ("v4l-utils" ,v4l-utils)))
+     (list freetype
+           sdl2
+           sdl2-image
+           sdl2-mixer
+           sdl2-ttf
+           sdl2-gfx
+           libjpeg-turbo
+           libpng
+           libx11
+           libsmpeg
+           portmidi
+           v4l-utils))