diff mbox series

[bug#52116,1/2] gnu: Add python-pyglet.

Message ID BYAPR05MB4023765F4720BC3D7069A896C5639@BYAPR05MB4023.namprd05.prod.outlook.com
State New
Headers show
Series gnu: Add printrun. | expand

Commit Message

Morgan Smith Nov. 26, 2021, 12:58 a.m. UTC
From: Morgan Smith <Morgan.J.Smith@outlook.com>

* gnu/packages/python-xyz.scm (python-pyglet): New variable.
---
 gnu/packages/python-xyz.scm | 55 +++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index d33469815a..79677cccc5 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -28174,3 +28174,58 @@  (define-public bmap-tools
     ;; contrib/bmap_write.py is gpl2+
     ;; The rest is gpl2
     (license (list license:gpl2+ license:gpl2))))
+
+(define-public python-pyglet
+  (package
+    (name "python-pyglet")
+    (version "1.5.21")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "pyglet" version ".zip"))
+       (sha256
+        (base32
+         "1qi8jz8dbyyz3yjz7jm94mll1libda08sk9512xgkdn4dnqdvajs"))))
+    (build-system python-build-system)
+    (inputs
+     `(("mesa" ,mesa)
+       ("glu" ,glu)
+       ("freetype" ,freetype)
+       ("fontconfig" ,fontconfig)
+       ("libx11" ,libx11)))
+    (native-inputs
+     `(("python-pytest" ,python-pytest)
+       ("python-pytest-cov" ,python-pytest-cov)
+       ("python-pillow" ,python-pillow)
+       ("xorg-server" ,xorg-server-for-tests)
+       ("unzip" ,unzip)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'fix-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'")))
+             (substitute* "pyglet/libs/x11/xlib.py"
+               (("'X11'")
+                (string-append "'" (assoc-ref inputs "libx11") "/lib/libX11.so'")))))
+         (replace 'check
+           (lambda* (#:key tests? inputs outputs #:allow-other-keys)
+             (when tests?
+               (add-installed-pythonpath inputs outputs)
+               (system "Xvfb :1 &")
+               (setenv "DISPLAY" ":1")
+               (invoke "pytest" "tests/unit")))))))
+    (home-page "http://pyglet.readthedocs.io/en/latest/")
+    (synopsis "Cross-platform windowing and multimedia library")
+    (description "Cross-platform windowing and multimedia library")
+    (license license:bsd-3)))