projects/guix·blob graal · refs

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