aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/python-xyz.scm
diff options
context:
space:
mode:
authorJean-Pierre De Jesus DIAZ <me@jeandudey.tech>2022-06-10 19:57:31 +0200
committerLudovic Courtès <ludo@gnu.org>2022-06-17 15:31:34 +0200
commitd18f701aa12e1b881bea743d076ca89f96798f64 (patch)
treec20b5b4474e3a2005b9951fa95154035e73f3fc5 /gnu/packages/python-xyz.scm
parent88f6776728bbe1fd21e4b3dfef2ae291ba074067 (diff)
downloadguix-d18f701aa12e1b881bea743d076ca89f96798f64.tar
guix-d18f701aa12e1b881bea743d076ca89f96798f64.tar.gz
gnu: Add python-pysdl2.
* gnu/packages/python-xyz.scm (python-pysdl2): New variable. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/packages/python-xyz.scm')
-rw-r--r--gnu/packages/python-xyz.scm66
1 files changed, 66 insertions, 0 deletions
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 4b8e63890f..285863df07 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -123,6 +123,7 @@
;;; Copyright © 2022 Jai Vetrivelan <jaivetrivelan@gmail.com>
;;; Copyright © 2022 Artyom V. Poptsov <poptsov.artyom@gmail.com>
;;; Copyright © 2022 Paul A. Patience <paul@apatience.com>
+;;; Copyright © 2022 Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -3901,6 +3902,71 @@ adds a 'now' tag providing a convenient access to the arrow.now() API from
templates. A format string can be provided to control the output.")
(license license:expat)))
+(define-public python-pysdl2
+ (package
+ (name "python-pysdl2")
+ (version "0.9.11")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "PySDL2" version))
+ (sha256
+ (base32
+ "19id1qswgcj4v4j5kn49shq1xxx3slhjpm0102w87mczsdbi1rck"))))
+ (build-system python-build-system)
+ (arguments
+ (list #:tests? #f ;; Requires /dev/dri, OpenGL module, etc.
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-paths
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "sdl2/dll.py"
+ ;; Disable pysdl2-dll. It can't be packaged on GNU Guix
+ ;; as it duplicates an existing package (sdl2).
+ (("prepath = os\\.getenv\\('PYSDL2_DLL_PATH'\\)")
+ "prepath = \"system\"")
+ (("^import sdl2dll$") "")
+ (("postpath = os\\.getenv\\('PYSDL2_DLL_PATH'\\)")
+ "postpath = \"system\"")
+ (("DLL\\(.*, os\\.getenv\\(\"PYSDL2_DLL_PATH\"\\)\\)")
+ (string-append
+ "DLL(\"SDL2\", [\"SDL2\", \"SDL2-2.0\", \"SDL2-2.0.0\"], \""
+ (dirname (search-input-file inputs "/lib/libSDL2.so"))
+ "\")")))
+ (substitute* "sdl2/sdlimage.py"
+ (("os\\.getenv\\(\"PYSDL2_DLL_PATH\"\\)")
+ (string-append
+ "\""
+ (dirname (search-input-file inputs "/lib/libSDL2_image.so"))
+ "\"")))
+ (substitute* "sdl2/sdlgfx.py"
+ (("os\\.getenv\\(\"PYSDL2_DLL_PATH\"\\)")
+ (string-append
+ "\""
+ (dirname (search-input-file inputs "/lib/libSDL2_gfx.so"))
+ "\"")))
+ (substitute* "sdl2/sdlmixer.py"
+ (("os\\.getenv\\(\"PYSDL2_DLL_PATH\"\\)")
+ (string-append
+ "\""
+ (dirname (search-input-file inputs "/lib/libSDL2_mixer.so"))
+ "\"")))
+ (substitute* "sdl2/sdlttf.py"
+ (("os\\.getenv\\(\"PYSDL2_DLL_PATH\"\\)")
+ (string-append
+ "\""
+ (dirname (search-input-file inputs "/lib/libSDL2_ttf.so"))
+ "\""))))))))
+ (inputs
+ (list sdl2 sdl2-image sdl2-gfx sdl2-mixer sdl2-ttf))
+ (home-page "https://github.com/py-sdl/py-sdl2")
+ (synopsis "Python bindings around the SDL2 game development library")
+ (description "PySDL2 is a pure Python wrapper around the @code{SDL2},
+@code{SDL2_mixer}, @code{SDL2_image}, @code{SDL2_ttf}, and @code{SDL2_gfx}
+libraries. Instead of relying on C code, it uses the built-in ctypes module
+to interface with SDL2, and provides simple Python classes and wrappers for
+common SDL2 functionality.")
+ (license license:cc0)))
+
(define-public python-pystache
(package
(name "python-pystache")