projects/guix·blob dexed · refs

882 lines · 34.5 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2020, 2023 Lars-Dominik Braun <[email protected]>
3;;; Copyright © 2021 Adam Kandur <[email protected]>
4;;; Copyright © 2021 Ekaitz Zarraga <[email protected]>
5;;; Copyright © 2021 Ludovic Courtès <[email protected]>
6;;; Copyright © 2021 Morgan Smith <[email protected]>
7;;; Copyright © 2021, 2023 Daniel Meißner <[email protected]>
8;;; Copyright © 2022 Jean-Pierre De Jesus DIAZ <[email protected]>
9;;; Copyright © 2022 Marius Bakke <[email protected]>
10;;; Copyright © 2022 Ryan Prior <[email protected]>
11;;; Copyright © 2023 Adam Faiz <[email protected]>
12;;; Copyright © 2023 Simon Tournier <[email protected]>
13;;; Copyright © 2024 Artyom V. Poptsov <[email protected]>
14;;; Copyright © 2024-2025 Sharlatan Hellseher <[email protected]>
15;;; Copyright © 2025 Sisiutl <[email protected]>
16;;;
17;;; This file is part of GNU Guix.
18;;;
19;;; GNU Guix is free software; you can redistribute it and/or modify it
20;;; under the terms of the GNU General Public License as published by
21;;; the Free Software Foundation; either version 3 of the License, or (at
22;;; your option) any later version.
23;;;
24;;; GNU Guix is distributed in the hope that it will be useful, but
25;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27;;; GNU General Public License for more details.
28;;;
29;;; You should have received a copy of the GNU General Public License
30;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
32(define-module (gnu packages python-graphics)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix build-system pyproject)
35 #:use-module (guix build-system python)
36 #:use-module (guix download)
37 #:use-module (guix gexp)
38 #:use-module (guix git-download)
39 #:use-module (guix packages)
40 #:use-module (gnu packages)
41 #:use-module (gnu packages audio)
42 #:use-module (gnu packages base)
43 #:use-module (gnu packages boost)
44 #:use-module (gnu packages check)
45 #:use-module (gnu packages cmake)
46 #:use-module (gnu packages compression)
47 #:use-module (gnu packages fontutils)
48 #:use-module (gnu packages game-development)
49 #:use-module (gnu packages gl)
50 #:use-module (gnu packages graphics)
51 #:use-module (gnu packages gstreamer)
52 #:use-module (gnu packages gtk)
53 #:use-module (gnu packages image)
54 #:use-module (gnu packages maths)
55 #:use-module (gnu packages pkg-config)
56 #:use-module (gnu packages pulseaudio)
57 #:use-module (gnu packages python)
58 #:use-module (gnu packages python-build)
59 #:use-module (gnu packages python-web)
60 #:use-module (gnu packages python-xyz)
61 #:use-module (gnu packages qt)
62 #:use-module (gnu packages sdl)
63 #:use-module (gnu packages simulation)
64 #:use-module (gnu packages swig)
65 #:use-module (gnu packages video)
66 #:use-module (gnu packages xorg))
67
68;;; Commentary:
69;;;
70;;; Python modules which are meant to be used in GUI creation or mainly are
71;;; bindings to low level libraries such as Glue, Mesa, OpenGL, Xorg etc.
72;;;
73;;; Please: Try to add new module packages in alphabetic order.
74;;;
75;;; Code:
76
77(define-public python-asyncgui
78 (package
79 (name "python-asyncgui")
80 (version "0.8.0")
81 (source
82 (origin
83 (method git-fetch) ; no tests in PyPI release
84 (uri (git-reference
85 (url "https://github.com/asyncgui/asyncgui")
86 (commit version)))
87 (file-name (git-file-name name version))
88 (sha256
89 (base32 "1b074msb580wify2wag3swm3s21x23kckxpw974y6dibsmrfr5n3"))))
90 (build-system pyproject-build-system)
91 (native-inputs
92 (list python-poetry-core
93 python-pytest))
94 (home-page "https://github.com/asyncgui/asyncgui")
95 (synopsis "Enables async/await without an event loop")
96 (description
97 "This package provides support for async/await applications without
98requiring an event loop, useful for creative responsive GUIs.")
99 (license license:expat)))
100
101(define-public python-asynckivy
102 (package
103 (name "python-asynckivy")
104 (version "0.8.1")
105 (source
106 (origin
107 (method git-fetch) ; no tests in PyPI release
108 (uri (git-reference
109 (url "https://github.com/asyncgui/asynckivy")
110 (commit version)))
111 (file-name (git-file-name name version))
112 (sha256
113 (base32 "0gjddv6d7bbjymvly2x5zaay1gyihls1c4bh7y1ppbvz15152lkj"))))
114 (build-system pyproject-build-system)
115 (arguments
116 (list
117 #:phases
118 #~(modify-phases %standard-phases
119 (add-before 'check 'set-home
120 (lambda _
121 ;; 'kivy/__init__.py' wants to create $HOME/.kivy.
122 (setenv "HOME" "/tmp"))))))
123 (native-inputs
124 (list python-poetry-core
125 python-pytest))
126 (propagated-inputs
127 (list python-kivy
128 python-asyncgui))
129 (home-page "https://github.com/asyncgui/asynckivy")
130 (synopsis "Async library for Kivy")
131 (description
132 "This package provides async versions of Kivy functions to avoid the
133callback-heavy mode of interaction typical in some Kivy applications.")
134 (license license:expat)))
135
136(define-public python-glcontext
137 (let (;; Upstream is known for abusing mutable tag, hence pinpoint the
138 ;; relevant commit.
139 (revision "2")
140 (commit "f2875abdb18b24e785c3958cc22845c81725d5cd"))
141 (package
142 (name "python-glcontext")
143 (version (git-version "3.0.0" revision commit))
144 (source
145 (origin
146 (method git-fetch)
147 (uri (git-reference
148 (url "https://github.com/moderngl/glcontext")
149 (commit commit)))
150 (file-name (git-file-name name version))
151 (sha256
152 (base32 "15pngnc4agdvm8crq782vjlb5v1qrclln5xpqiyhz3jhmipsqb8q"))))
153 (build-system pyproject-build-system)
154 (arguments
155 (list
156 #:phases
157 #~(modify-phases %standard-phases
158 (add-before 'build 'fix-lib-paths
159 (lambda* (#:key inputs outputs #:allow-other-keys)
160 (let ((mesa (assoc-ref inputs "mesa"))
161 (libx11 (assoc-ref inputs "libx11")))
162 (substitute* '("glcontext/x11.cpp"
163 "glcontext/egl.cpp")
164 (("\"libGL.so\"")
165 (string-append "\"" mesa "/lib/libGL.so\""))
166 (("\"libEGL.so\"")
167 (string-append "\"" mesa "/lib/libEGL.so\""))
168 (("\"libX11.so\"")
169 (string-append "\"" libx11 "/lib/libX11.so\"")))
170 (substitute* '("glcontext/__init__.py")
171 (("find_library\\('GL'\\)")
172 (string-append "'" mesa "/lib/libGL.so'"))
173 (("find_library\\('EGL'\\)")
174 (string-append "'" mesa "/lib/libEGL.so'"))
175 (("find_library\\(\"X11\"\\)")
176 (string-append "'" libx11 "/lib/libX11.so'"))))))
177 (add-before 'check 'prepare-test-environment
178 (lambda _
179 (system "Xvfb :1 &")
180 (setenv "DISPLAY" ":1"))))))
181 (inputs
182 (list libx11
183 mesa))
184 (native-inputs
185 (list python-psutil
186 python-pytest
187 python-setuptools
188 python-wheel
189 xorg-server-for-tests))
190 (home-page "https://github.com/moderngl/glcontext")
191 (synopsis "Portable OpenGL Context for ModernGL")
192 (description
193 "Python-glcontext is a library providing an OpenGL implementation for
194ModernGL on multiple platforms.")
195 (license license:expat))))
196
197(define-public python-glfw
198 (package
199 (name "python-glfw")
200 (version "2.8.0")
201 (source
202 (origin
203 (method url-fetch)
204 (uri (pypi-uri "glfw" version))
205 (sha256
206 (base32 "1w36jvn6fx8p7irhwj6bbl67m2id3s0227b3w7bgw9hbicr0vsch"))))
207 (build-system pyproject-build-system)
208 (arguments
209 (list
210 #:tests? #f ; no tests provided
211 #:phases
212 #~(modify-phases %standard-phases
213 (add-after 'unpack 'fix-lib-paths
214 (lambda _
215 (substitute* "glfw/library.py"
216 (("_get_library_search_paths\\(\\), ")
217 (format #f "[ '~a/lib' ],"
218 #$(this-package-input "glfw")))))))))
219 (native-inputs
220 (list python-pytest
221 python-setuptools
222 python-wheel))
223 (inputs
224 (list glfw))
225 (home-page "https://github.com/FlorianRhiem/pyGLFW")
226 (synopsis "Python bindings for GLFW")
227 (description
228 "This package provides Python bindings for @url{http://www.glfw.org/,
229GLFW} OpenGL application development library.")
230 (license license:expat)))
231
232(define-public python-kivy
233 (package
234 (name "python-kivy")
235 (version "2.3.1")
236 (source
237 (origin
238 (method url-fetch)
239 (uri (pypi-uri "Kivy" version))
240 (sha256
241 (base32 "1ngrnkrp6xgfl4x32i2nv3bml13l8qwa87cwrymv9k826ng98cq8"))))
242 (build-system pyproject-build-system)
243 (arguments
244 `(#:tests? #f ; Tests require many optional packages
245 #:phases
246 (modify-phases %standard-phases
247 (add-after 'patch-generated-file-shebangs 'set-sdl-paths
248 (lambda* (#:key inputs #:allow-other-keys)
249 (setenv "KIVY_SDL2_PATH"
250 (search-input-directory inputs "/include/SDL2"))))
251 (add-before 'build 'set-home
252 (lambda _
253 ;; 'kivy/__init__.py' wants to create $HOME/.kivy.
254 (setenv "HOME" (getcwd)))))))
255 (native-inputs
256 (list pkg-config
257 python-cython-0
258 ;; Not packaged yet, for tests.
259 ;; python-kivy-deps-glew
260 ;; python-kivy-deps-glew-dev
261 ;; python-kivy-deps-gstreamer
262 ;; python-kivy-deps-gstreamer-dev
263 ;; python-kivy-deps-sdl2
264 ;; python-kivy-deps-sdl2-dev
265 python-packaging
266 python-setuptools
267 python-wheel))
268 (inputs
269 (list gstreamer
270 mesa
271 (sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf))))
272 (propagated-inputs
273 (list python-docutils
274 python-filetype
275 python-kivy-garden
276 python-pygments
277 python-requests))
278 (home-page "https://kivy.org")
279 (synopsis "Multitouch application framework")
280 (description
281 "Kivy is a software library for rapid development of hardware-accelerated
282multitouch applications.")
283 (license license:expat)))
284
285(define-public python-kivymd
286 (package
287 (name "python-kivymd")
288 (version "1.1.1")
289 (source
290 (origin
291 (method git-fetch) ; no tests in PyPI release
292 (uri (git-reference
293 (url "https://github.com/kivymd/KivyMD")
294 (commit version)))
295 (file-name (git-file-name name version))
296 (sha256
297 (base32 "1nprldcm54qybbwf7zlb32fkmz375j8i3k3g41d6ykc6vasq3w5j"))))
298 (build-system pyproject-build-system)
299 (arguments
300 (list
301 #:test-flags
302 ;; <https://github.com/pyinstaller/pyinstaller> is not packaged yet in
303 ;; Guix.
304 #~(list "--ignore=kivymd/tests/pyinstaller"
305 "-k" (string-join
306 ;; FIXME: Only some tests passed, the most fail with err:
307 ;; ValueError: KivyMD: App object must be initialized
308 ;; before loading root widget.
309 (list "not test_backdrop_raw_app"
310 "test_bottom_navigation_m3_style_raw_app"
311 "test_card_m3_style_raw_app"
312 "test_chip_raw_app"
313 "test_imagelist_raw_app"
314 "test_list_raw_app"
315 "test_navigationdrawer_raw_app"
316 "test_tab_raw_app"
317 "test_textfield_raw_app")
318 " and not "))
319 #:phases
320 #~(modify-phases %standard-phases
321 (add-after 'unpack 'fix-modules
322 (lambda _
323 (substitute* "setup.py"
324 ;; If excluded, sanity check fails with error:
325 ;; ModuleNotFoundError: No module named 'kivymd.tools.release'
326 (("\"kivymd.tools.release\"") ""))
327 ;; Check phase fails struggling to find tests module.
328 (with-output-to-file "kivymd/tests/__init__.py"
329 (lambda _ (display "")))))
330 (add-before 'check 'set-home
331 (lambda _
332 ;; FileNotFoundError: [Errno 2] No such file or directory:
333 ;; '/homeless-shelter/.kivy'
334 (setenv "HOME" "/tmp"))))))
335 (native-inputs
336 (list python-docutils
337 python-pytest
338 python-pytest-asyncio
339 python-setuptools
340 python-wheel))
341 (propagated-inputs
342 (list python-kivy
343 python-pillow
344 python-pygments
345 python-kivy-garden))
346 (home-page "https://github.com/kivymd/KivyMD")
347 (synopsis "Material Design compliant widgets for use with Kivy")
348 (description
349 "This package provides Kivy widgets that approximate Google's Material
350Design spec without sacrificing ease of use or application performance.")
351 (license license:expat)))
352
353(define-public python-pivy
354 (package
355 (name "python-pivy")
356 (version "0.6.8")
357 (source
358 (origin
359 (method git-fetch)
360 (uri (git-reference
361 (url "https://github.com/coin3d/pivy")
362 (commit version)))
363 (file-name (git-file-name name version))
364 (sha256
365 (base32 "00l4r06dwmgn8h29nrl3g3yv33cfyizyylk28x1j95qyj36sggfb"))))
366 (build-system python-build-system)
367 (arguments
368 (list
369 ;; The test suite fails due to an import cycle between 'pivy' and '_coin'
370 #:tests? #f
371 #:phases
372 #~(modify-phases %standard-phases
373 (add-after 'unpack 'patch-cmake-include-dirs
374 (lambda _
375 ;; Patch buildsystem to respect Coin3D include directory
376 (substitute* "CMakeLists.txt"
377 (("\\$\\{SoQt_INCLUDE_DIRS}")
378 "${Coin_INCLUDE_DIR};${SoQt_INCLUDE_DIRS}")))))))
379 (native-inputs
380 (list cmake-minimal swig))
381 (inputs
382 (list python-wrapper
383 qtbase-5
384 libxi
385 libice
386 glew
387 coin3d))
388 (home-page "https://github.com/coin3d/pivy")
389 (synopsis "Python bindings to Coin3D")
390 (description
391 "Pivy provides python bindings for Coin, a 3D graphics library with an
392Application Programming Interface based on the Open Inventor 2.1 API.")
393 (license license:isc)))
394
395(define-public python-py3exiv2
396 (package
397 (name "python-py3exiv2")
398 (version "0.12.0")
399 (source
400 (origin
401 (method url-fetch)
402 ;; Source: https://code.launchpad.net/py3exiv2
403 (uri (pypi-uri "py3exiv2" version))
404 (sha256
405 (base32 "12is7xb393wvq3la9lhi0y1xkmpvjj6v13cikb7k6iqcfrgkxckj"))))
406 (build-system pyproject-build-system)
407 (arguments
408 (list #:tests? #f)) ;no tests in PyPI
409 (native-inputs
410 (list boost
411 python-setuptools))
412 (inputs
413 (list exiv2))
414 (home-page "https://www.py3exiv2.tuxfamily.org/")
415 (synopsis "Python binding to the exiv2 library")
416 (description
417 "This package provides a Python binding to the library
418@code{https://exiv2.org/, exiv2} - cross-platform C++ library and a command
419line utility to manage image metadata.")
420 (license license:gpl3+)))
421
422(define-public python-pyglet
423 (package
424 (name "python-pyglet")
425 (version "2.0.18")
426 (source
427 (origin
428 (method url-fetch)
429 (uri (pypi-uri "pyglet" version))
430 (sha256
431 (base32 "1p4rizj81vfqxal288m3afbrgk0il3w7k5kmhai2sah8f26j7ybw"))))
432 (build-system pyproject-build-system)
433 (arguments
434 (list
435 #:test-flags
436 #~(list "tests"
437 "--ignore=tests/interactive"
438 ;; All tests errored
439 "--ignore=tests/integration/media/test_openal.py"
440 "--ignore=tests/integration/text/test_empty_document.py"
441 ;; Tests failed
442 "-k" (string-append "not test2"
443 " and not test5"
444 " and not testPad"
445 " and not testPad"
446 " and not testRange"
447 " and not testRect"
448 " and not testRect"
449 " and not testSet"
450 " and not testSquare"
451 " and not testSquare"
452 " and not testTuple"
453 " and not testTupleRange"
454 " and not test_context_noshare_texture"
455 " and not test_context_share_texture"
456 " and not test_method"
457 " and not test_openal_listener"
458 " and not test_parse_all_controller_mappings"
459 " and not test_player_play"
460 " and not test_player_play_multiple"
461 " and not test_stream_write_needed"
462 " and not test_window_caption"
463 " and not test_window_caption_from_argv"))
464 #:phases
465 #~(modify-phases %standard-phases
466 (add-after 'unpack 'patch-lib-paths
467 (lambda* (#:key inputs #:allow-other-keys)
468 (substitute* (list "pyglet/font/fontconfig.py"
469 "pyglet/font/freetype_lib.py"
470 "pyglet/gl/lib_glx.py"
471 "pyglet/input/linux/evdev.py"
472 "pyglet/libs/egl/egl.py"
473 "pyglet/libs/egl/lib.py"
474 "pyglet/libs/x11/xf86vmode.py"
475 "pyglet/libs/x11/xinerama.py"
476 "pyglet/libs/x11/xlib.py"
477 "pyglet/libs/x11/xsync.py"
478 "pyglet/media/drivers/openal/lib_openal.py"
479 "pyglet/media/drivers/pulse/lib_pulseaudio.py")
480 (("'EGL'")
481 (format #f "'~a/~a'" #$(this-package-input "mesa")
482 "lib/libEGL.so"))
483 (("\"fontconfig\"")
484 (format #f "'~a/~a'" #$(this-package-input "fontconfig-minimal")
485 "lib/libfontconfig.so"))
486 (("\"freetype\"")
487 (format #f "'~a/~a'" #$(this-package-input "freetype")
488 "lib/libfreetype.so"))
489 (("'GL'")
490 (format #f "'~a/~a'" #$(this-package-input "mesa")
491 "lib/libGL.so"))
492 (("'GLU'")
493 (format #f "'~a/~a'" #$(this-package-input "glu")
494 "lib/libGLU.so"))
495 (("'X11'")
496 (format #f "'~a/~a'" #$(this-package-input "libx11")
497 "lib/libX11.so"))
498 (("'Xext'")
499 (format #f "'~a/~a'" #$(this-package-input "libxext")
500 "lib/libXext.so"))
501 (("'Xinerama'")
502 (format #f "'~a/~a'" #$(this-package-input "libxinerama")
503 "lib/libXinerama.so"))
504 (("'Xxf86vm'")
505 (format #f "'~a/~a'" #$(this-package-input "libxxf86vm")
506 "lib/libXxf86vm.so"))
507 (("'c'")
508 (format #f "'~a/~a'" #$(this-package-input "glibc")
509 "lib/libc.so"))
510 (("'gdk-x11-2.0'")
511 (format #f "'~a/~a'" #$(this-package-input "gtk+")
512 "lib/gdk-pixbuf-2.0.so"))
513 (("'gdk_pixbuf-2.0'")
514 (format #f "'~a/~a'" #$(this-package-input "gdk-pixbuf")
515 "lib/libgdk_pixbuf-2.0.so"))
516 (("'openal'")
517 (format #f "'~a/~a'" #$(this-package-input "openal")
518 "lib/libopenal.so"))
519 (("'pulse'")
520 (format #f "'~a/~a'" #$(this-package-input "pulseaudio")
521 "lib/libpulse.so")))))
522 (add-before 'check 'prepare-test-environment
523 (lambda _
524 ;; The test suite requires a running X server.
525 (system "Xvfb :1 &")
526 (setenv "DISPLAY" ":1")
527 (setenv "HOME" "/tmp")
528 (setenv "PYGLET_HEADLESS" "True"))))))
529 (native-inputs
530 (list python-flit-core
531 python-pytest
532 unzip
533 xorg-server-for-tests))
534 (inputs
535 (list ffmpeg
536 fontconfig
537 freeglut
538 freetype
539 gdk-pixbuf
540 glibc
541 glu
542 gtk+
543 libx11
544 libxext
545 libxinerama
546 libxxf86vm
547 mesa
548 openal
549 pulseaudio))
550 (home-page "https://github.com/pyglet/pyglet")
551 (synopsis "Windowing and multimedia library")
552 (description
553 "Pyglet is a Python library for developing games and other visually-rich
554applications. It supports windowing, user interface event handling,
555Joysticks, OpenGL graphics, loading images and videos, playing sounds and
556music." )
557 (license license:bsd-3)))
558
559(define-public python-pyglet-1
560 (package
561 (inherit python-pyglet)
562 (name "python-pyglet")
563 (version "1.5.30") ;the latest 1.* version from 2024-12-24
564 (source
565 (origin
566 (method git-fetch)
567 (uri (git-reference
568 (url "https://github.com/pyglet/pyglet")
569 (commit (string-append "v" version))))
570 (file-name (git-file-name name version))
571 (sha256
572 (base32 "0q1690pqkks3na6vc8ps44h0gymlmq752xlk7fm0yvz05yqdqn51"))))
573 (arguments
574 (list
575 ;; tests: 317 passed, 24 skipped, 1 deselected, 2 warnings
576 #:test-flags
577 #~(list "--ignore=tests/base"
578 "--ignore=tests/interactive"
579 "--ignore=tests/integration/media"
580 "--ignore=tests/integration/font"
581 "--ignore=tests/integration/platform/test_linux_fontconfig.py"
582 ;; AssertionError: False is not true : Did not receive next
583 ;; expected event
584 "--ignore=tests/integration/window/test_event_sequence.py"
585 ;; pyglet.media.drivers.openal.interface.OpenALException: OpenAL
586 ;; Exception [40964: b'Invalid Value']: Failed to open device.
587 "--deselect=tests/unit/media/test_listener.py::test_openal_listener")
588 #:phases
589 #~(modify-phases %standard-phases
590 (add-after 'unpack 'patch-lib-paths
591 (lambda* (#:key inputs #:allow-other-keys)
592 (substitute* (list "pyglet/font/fontconfig.py"
593 "pyglet/font/freetype_lib.py"
594 "pyglet/gl/lib_glx.py"
595 "pyglet/libs/egl/egl.py"
596 "pyglet/libs/egl/lib.py"
597 "pyglet/libs/x11/xf86vmode.py"
598 "pyglet/libs/x11/xinerama.py"
599 "pyglet/libs/x11/xlib.py"
600 "pyglet/libs/x11/xsync.py"
601 "pyglet/media/drivers/openal/lib_openal.py"
602 "pyglet/media/drivers/pulse/lib_pulseaudio.py")
603 (("'EGL'")
604 (format #f "'~a/~a'" #$(this-package-input "mesa")
605 "lib/libEGL.so"))
606 (("'fontconfig'")
607 (format #f "'~a/~a'" #$(this-package-input "fontconfig-minimal")
608 "lib/libfontconfig.so"))
609 (("'freetype'")
610 (format #f "'~a/~a'" #$(this-package-input "freetype")
611 "lib/libfreetype.so"))
612 (("'GL'")
613 (format #f "'~a/~a'" #$(this-package-input "mesa")
614 "lib/libGL.so"))
615 (("'GLU'")
616 (format #f "'~a/~a'" #$(this-package-input "glu")
617 "lib/libGLU.so"))
618 (("'X11'")
619 (format #f "'~a/~a'" #$(this-package-input "libx11")
620 "lib/libX11.so"))
621 (("'Xext'")
622 (format #f "'~a/~a'" #$(this-package-input "libxext")
623 "lib/libXext.so"))
624 (("'Xinerama'")
625 (format #f "'~a/~a'" #$(this-package-input "libxinerama")
626 "lib/libXinerama.so"))
627 (("'Xxf86vm'")
628 (format #f "'~a/~a'" #$(this-package-input "libxxf86vm")
629 "lib/libXxf86vm.so"))
630 (("'c'")
631 (format #f "'~a/~a'" #$(this-package-input "glibc")
632 "lib/libc.so"))
633 (("'gdk-x11-2.0'")
634 (format #f "'~a/~a'" #$(this-package-input "gtk+")
635 "lib/gdk-pixbuf-2.0.so"))
636 (("'gdk_pixbuf-2.0'")
637 (format #f "'~a/~a'" #$(this-package-input "gdk-pixbuf")
638 "lib/libgdk_pixbuf-2.0.so"))
639 (("'openal'")
640 (format #f "'~a/~a'" #$(this-package-input "openal")
641 "lib/libopenal.so"))
642 (("'pulse'")
643 (format #f "'~a/~a'" #$(this-package-input "pulseaudio")
644 "lib/libpulse.so")))))
645 (add-before 'check 'prepare-test-environment
646 (lambda _
647 ;; The test suite requires a running X server.
648 (system "Xvfb :1 &")
649 (setenv "DISPLAY" ":1")
650 (setenv "HOME" "/tmp")
651 (setenv "PYGLET_HEADLESS" "True"))))))
652 (native-inputs
653 (list python-pytest
654 python-setuptools
655 xorg-server-for-tests))))
656
657(define-public python-pyopengl
658 (package
659 (name "python-pyopengl")
660 (version "3.1.9")
661 (source
662 (origin
663 (method url-fetch)
664 (uri (pypi-uri "PyOpenGL" version))
665 (sha256
666 (base32
667 "09syrsfrcknr1k2wmj05gfd5d0dyjfxzbipzbd0agv9775vwi9lf"))))
668 (build-system pyproject-build-system)
669 (arguments
670 (list
671 ;; tests: 54 passed, 5 skipped, 8 deselected, 5 warnings
672 #:test-flags
673 #~(list "-k" (string-join
674 ;; XXX: Check why these test fail.
675 (list "not test_get_read_fb_binding"
676 "test_get_version"
677 "test_glCallLists_twice2"
678 "test_glmultidraw"
679 "test_lookupint"
680 "test_numpyConversion"
681 "test_pointers")
682 " and not ")
683 ;; TypeError: list indices must be integers or slices, not
684 ;; numpy.bool
685 "--deselect=tests/test_core.py::TestCore::test_vbo")
686 #:phases
687 #~(modify-phases %standard-phases
688 (add-before 'build 'fix-paths
689 (lambda _
690 (substitute* '("OpenGL/platform/ctypesloader.py")
691 (("filenames_to_try = \\[\\]") "filenames_to_try = [name]"))
692 (substitute* '("OpenGL/platform/glx.py"
693 "OpenGL/platform/egl.py"
694 "OpenGL/platform/osmesa.py"
695 "OpenGL/platform/darwin.py"
696 "tests/check_glut_load.py")
697 (("'GLU'")
698 (format #f "'~a/~a'" #$(this-package-input "glu")
699 "lib/libGLU.so"))
700 (("'glut',")
701 (format #f "'~a/~a'," #$(this-package-input "freeglut")
702 "lib/libglut.so"))
703 (("'(GL|EGL|GLESv1_CM|GLESv2|OSMesa)'" all gl-library)
704 (format #f "'~a/~a'" #$(this-package-input "mesa")
705 (string-append "lib/lib" gl-library ".so"))))
706 ;; Not providing libgle. It seems to be very old.
707 )))))
708 (native-inputs
709 (list python-cython
710 python-numpy
711 python-pygame
712 python-pytest
713 python-setuptools
714 python-wheel))
715 (inputs
716 (list freeglut
717 glu
718 mesa))
719 (home-page "https://pyopengl.sourceforge.net")
720 (synopsis "Standard OpenGL bindings for Python")
721 (description
722 "PyOpenGL is the most common cross platform Python binding to OpenGL and
723related APIs. The binding is created using the standard @code{ctypes}
724library.")
725 (license license:bsd-3)))
726
727(define-public python-pyopengl-accelerate
728 (package
729 (inherit python-pyopengl)
730 (name "python-pyopengl-accelerate")
731 (version "3.1.10")
732 (source
733 (origin
734 (method url-fetch)
735 (uri (pypi-uri "pyopengl_accelerate" version))
736 (sha256
737 (base32
738 "0waskwvw9mp830bnnxcqd8bkh7a4qbnr0fcjnnw35xx6y21iqxc2"))))
739 (arguments
740 `(#:tests? #f
741 #:phases
742 (modify-phases %standard-phases
743 (delete 'fix-paths))))
744 (synopsis "Acceleration code for PyOpenGL")
745 (description
746 "This is the Cython-coded accelerator module for PyOpenGL.")))
747
748(define-public python-pysdl2
749 (package
750 (name "python-pysdl2")
751 (version "0.9.17")
752 (source
753 (origin
754 (method url-fetch)
755 (uri (pypi-uri "pysdl2" version))
756 (sha256
757 (base32 "0axm6m3wj8x643zg65g60xdpaxanaqdilvp4yysks4pblh0yzij8"))))
758 (build-system pyproject-build-system)
759 (arguments
760 (list
761 #:tests? #f ;; Requires /dev/dri, OpenGL module, etc.
762 #:phases
763 #~(modify-phases %standard-phases
764 (add-after 'unpack 'patch-paths
765 (lambda _
766 (substitute* "sdl2/dll.py"
767 ;; Disable pysdl2-dll. It can't be packaged on GNU Guix
768 ;; as it duplicates an existing package (sdl2).
769 (("prepath = os\\.getenv\\('PYSDL2_DLL_PATH'\\)")
770 "prepath = \"system\"")
771 (("^import sdl2dll$") "")
772 (("postpath = os\\.getenv\\('PYSDL2_DLL_PATH'\\)")
773 "postpath = \"system\"")
774 (("DLL\\(.*, os\\.getenv\\(\"PYSDL2_DLL_PATH\"\\)\\)")
775 (format #f "DLL('SDL2', ['SDL2', 'SDL2-2.0', 'SDL2-2.0.0'], '~a/lib')"
776 #$(this-package-input "sdl2"))))
777 (substitute* "sdl2/sdlimage.py"
778 (("os\\.getenv\\(\"PYSDL2_DLL_PATH\"\\)")
779 (format #f "'~a/~a'" #$(this-package-input "sdl2-image")
780 "lib/libSDL2_image.so")))
781 (substitute* "sdl2/sdlgfx.py"
782 (("os\\.getenv\\(\"PYSDL2_DLL_PATH\"\\)")
783 (format #f "'~a/~a'" #$(this-package-input "sdl2-gfx")
784 "lib/libSDL2_gfx.so")))
785 (substitute* "sdl2/sdlmixer.py"
786 (("os\\.getenv\\(\"PYSDL2_DLL_PATH\"\\)")
787 (format #f "'~a/~a'" #$(this-package-input "sdl2-mixer")
788 "lib/libSDL2_mixer.so")))
789 (substitute* "sdl2/sdlttf.py"
790 (("os\\.getenv\\(\"PYSDL2_DLL_PATH\"\\)")
791 (format #f "'~a/~a'" #$(this-package-input "sdl2-ttf")
792 "lib/libSDL2_ttf.so"))))))))
793 (native-inputs
794 (list python-setuptools
795 python-wheel))
796 (inputs
797 (list sdl2 sdl2-image sdl2-gfx sdl2-mixer sdl2-ttf))
798 (home-page "https://github.com/py-sdl/py-sdl2")
799 (synopsis "Python bindings around the SDL2 game development library")
800 (description
801 "PySDL2 is a pure Python wrapper around the
802@code{SDL2},@code{SDL2_mixer}, @code{SDL2_image}, @code{SDL2_ttf}, and
803@code{SDL2_gfx} libraries. Instead of relying on C code, it uses the built-in
804ctypes module to interface with SDL2, and provides simple Python classes and
805wrappers for common SDL2 functionality.")
806 (license license:cc0)))
807
808(define-public python-vispy
809 (package
810 (name "python-vispy")
811 (version "0.14.3")
812 (source
813 (origin
814 (method url-fetch)
815 (uri (pypi-uri "vispy" version))
816 (sha256
817 (base32 "07fkk4bdffn0iq5cprk7ydj978rqc4lvzfcs2vkzgfh8m53vifzg"))))
818 (build-system pyproject-build-system)
819 (arguments
820 (list
821 #:test-flags
822 ;; Test requiring network access to download test data from
823 ;; <https://raw.githubusercontent.com/vispy/demo-data/main/CONTRIBUTING.txt>.
824 #~(list "-k" (string-append "not test_read_write_image"
825 " and not test_wavefront"
826 " and not test_config"))
827 #:phases
828 #~(modify-phases %standard-phases
829 (add-after 'unpack 'patch-library-path
830 (lambda _
831 (substitute* (list "vispy/ext/egl.py"
832 "vispy/ext/fontconfig.py"
833 "vispy/gloo/gl/es2.py"
834 "vispy/gloo/gl/gl2.py")
835 (("ctypes\\.util\\.find_library\\('EGL'\\)")
836 (format #f "'~a/~a'" #$(this-package-input "mesa")
837 "lib/libEGL.so"))
838 (("ctypes\\.util\\.find_library\\('GL'\\)")
839 (format #f "'~a/~a'" #$(this-package-input "mesa")
840 "lib/libGL.so"))
841 (("ctypes\\.util\\.find_library\\('GLESv2'\\)")
842 (format #f "'~a/~a'" #$(this-package-input "mesa")
843 "lib/libGLESv2.so"))
844 (("util\\.find_library\\('fontconfig'\\)")
845 (format #f "'~a/~a'" #$(this-package-input "fontconfig-minimal")
846 "lib/libfontconfig.so")))))
847 (add-before 'check 'prepare-test-environment
848 (lambda _
849 ;; XXX: Check how to set DPI to run headless tests, fails when
850 ;; DISPLAY is set.
851 ;; E RuntimeError: could not determine DPI
852 (setenv "HOME" "/tmp")
853 (invoke "python" "setup.py" "build_ext" "--inplace"))))))
854 (native-inputs
855 (list python-cython
856 python-pytest
857 python-setuptools
858 python-setuptools-scm
859 python-wheel))
860 (inputs
861 (list fontconfig
862 mesa))
863 (propagated-inputs
864 (list python-freetype-py
865 python-hsluv
866 python-kiwisolver
867 python-meshio
868 python-numpy
869 python-packaging
870 python-pillow))
871 (home-page "http://vispy.org")
872 (synopsis "Interactive scientific visualization in Python")
873 (description
874 "VisPy is a high-performance interactive 2D/3D data visualization library
875leveraging the computational power of modern Graphics Processing Units (GPUs)
876through the OpenGL library to display very large datasets.")
877 (license license:bsd-3)))
878
879;;;
880;;; Avoid adding new packages to the end of this file. To reduce the chances
881;;; of a merge conflict, place them above in alphabetical order.
882;;;