diff mbox series

[bug#50505,v3,05/12] gnu: Add python-pyglet.

Message ID 20220101235155.5754-6-daniel.meissner-i4k@ruhr-uni-bochum.de
State New
Headers show
Series Add python-manim and its missing dependencies | expand

Commit Message

Daniel Meißner Jan. 1, 2022, 11:51 p.m. UTC
* gnu/packages/python-xyz.scm (python-pyglet): New variable.
---
 gnu/packages/python-xyz.scm | 55 +++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

Comments

Liliana Marie Prikler Jan. 2, 2022, 12:36 a.m. UTC | #1
Am Sonntag, dem 02.01.2022 um 00:51 +0100 schrieb Daniel Meißner:
> +         (add-before 'build 'fix-lib-paths
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (substitute* '("pyglet/gl/lib_glx.py")
> +               (("'GL'")
> +                (string-append "\"" (assoc-ref inputs "mesa")
> +                               "/lib/libGL.so\""))
> +               (("'GLU'")
> +                (string-append "\"" (assoc-ref inputs "glu")
> +                               "/lib/libGLU.so\"")))
> +             (substitute* '("pyglet/font/freetype_lib.py")
> +               (("'freetype'")
> +                (string-append "\"" (assoc-ref inputs "freetype")
> +                               "/lib/libfreetype.so\"")))
> +             (substitute* '("pyglet/font/fontconfig.py")
> +               (("'fontconfig'")
> +                (string-append "\"" (assoc-ref inputs "fontconfig")
> +                               "/lib/libfontconfig.so\"")))))
Here as well, friendship ended with assoc-ref ;)

> +         (replace 'check
> +           (lambda* (#:key inputs outputs tests? #:allow-other-keys)
> +             (when tests?
> +               (system "Xvfb :1 &")
> +               (setenv "DISPLAY" ":1")
> +               (add-installed-pythonpath inputs outputs)
> +               (invoke "pytest" "tests/unit")))))))
We typically use a pre-check phase to set things up.  Does python
support #:test-target?

> +    (description
> +     "Pyglet is a Python library for developing games and other
> visually-rich
> +applications.  It supports windowing, user interface event handling,
> +Joysticks, OpenGL graphics, loading images and videos, and playing
> sounds and
> +music.  All of this with a friendly Pythonic API that's simple to
> learn.")
Last sentence sounds like an ad statement, the others can stay.
diff mbox series

Patch

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 21cf780338..e0d65daf91 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -19633,6 +19633,61 @@  (define-public python-moderngl
 also written in C++ for high performance.")
     (license license:expat)))
 
+(define-public python-pyglet
+  (package
+    (name "python-pyglet")
+    (version "1.5.18")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "pyglet" version ".zip"))
+       (sha256
+        (base32
+         "044ib8x6pv5rjwj210hq37ry7vi5bizmqkkv1zj8967prk5ii8sq"))))
+    (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'fix-lib-paths
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (substitute* '("pyglet/gl/lib_glx.py")
+               (("'GL'")
+                (string-append "\"" (assoc-ref inputs "mesa")
+                               "/lib/libGL.so\""))
+               (("'GLU'")
+                (string-append "\"" (assoc-ref inputs "glu")
+                               "/lib/libGLU.so\"")))
+             (substitute* '("pyglet/font/freetype_lib.py")
+               (("'freetype'")
+                (string-append "\"" (assoc-ref inputs "freetype")
+                               "/lib/libfreetype.so\"")))
+             (substitute* '("pyglet/font/fontconfig.py")
+               (("'fontconfig'")
+                (string-append "\"" (assoc-ref inputs "fontconfig")
+                               "/lib/libfontconfig.so\"")))))
+         (replace 'check
+           (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+             (when tests?
+               (system "Xvfb :1 &")
+               (setenv "DISPLAY" ":1")
+               (add-installed-pythonpath inputs outputs)
+               (invoke "pytest" "tests/unit")))))))
+    (inputs
+     `(("mesa" ,mesa)
+       ("glu" ,glu)
+       ("freetype" ,freetype)
+       ("fontconfig" ,fontconfig)))
+    (native-inputs
+     (list unzip python-pytest xorg-server-for-tests))
+    (home-page "https://pyglet.readthedocs.io")
+    (synopsis "Cross-platform windowing and multimedia Python library")
+    (description
+     "Pyglet is a Python library for developing games and other visually-rich
+applications.  It supports windowing, user interface event handling,
+Joysticks, OpenGL graphics, loading images and videos, and playing sounds and
+music.  All of this with a friendly Pythonic API that's simple to learn.")
+    (license license:bsd-3)))
+
 (define-public python-rencode
   (package
    (name "python-rencode")