From patchwork Sat Jan 1 23:51:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Daniel_Mei=C3=9Fner?= X-Patchwork-Id: 35877 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3416027BBEA; Sat, 1 Jan 2022 23:54:48 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 62B8B27BBE9 for ; Sat, 1 Jan 2022 23:54:46 +0000 (GMT) Received: from localhost ([::1]:43956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n3oCz-00074g-Ip for patchwork@mira.cbaines.net; Sat, 01 Jan 2022 18:54:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n3oBO-0005WV-Bx for guix-patches@gnu.org; Sat, 01 Jan 2022 18:53:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:48074) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n3oBO-0008BC-3A for guix-patches@gnu.org; Sat, 01 Jan 2022 18:53:06 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n3oBO-00038o-2V for guix-patches@gnu.org; Sat, 01 Jan 2022 18:53:06 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#50505] [PATCH v3 08/12] gnu: Add python-moderngl-window. Resent-From: Daniel =?utf-8?q?Mei=C3=9Fner?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 01 Jan 2022 23:53:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50505 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50505@debbugs.gnu.org Cc: Daniel =?utf-8?q?Mei=C3=9Fner?= , Xinglu Chen , Liliana Marie Prikler Received: via spool by 50505-submit@debbugs.gnu.org id=B50505.164108116011955 (code B ref 50505); Sat, 01 Jan 2022 23:53:06 +0000 Received: (at 50505) by debbugs.gnu.org; 1 Jan 2022 23:52:40 +0000 Received: from localhost ([127.0.0.1]:59606 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n3oAy-00036f-Am for submit@debbugs.gnu.org; Sat, 01 Jan 2022 18:52:40 -0500 Received: from out2.mail.ruhr-uni-bochum.de ([134.147.42.229]:54649) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n3oAm-000350-K1 for 50505@debbugs.gnu.org; Sat, 01 Jan 2022 18:52:34 -0500 Received: from mx2.mail.ruhr-uni-bochum.de (localhost [127.0.0.1]) by out2.mail.ruhr-uni-bochum.de (Postfix mo-ext) with ESMTP id 4JRJhl13tNz8S8x; Sun, 2 Jan 2022 00:52:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ruhr-uni-bochum.de; s=mail-2017; t=1641081143; bh=BghhmYt/4rB2N6ToNeLT/nNSgajdtRSWmZw921a5T+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CulM7ZG3zXGKBzdkbg5kj/XNHxCda3vIE2sHjvkC7nUfHSIvPXsswH/EI2vkazMPw irQeHjyANXmQHww6E6z7QBat4xlBs1/RYKTEUu67gVYZldNJK0dI2hlXnAQ8Ptg87P pICH2Sw0LHpSG5cZXHES4yCtkpql2XfO6wgUV2Eo= Received: from out2.mail.ruhr-uni-bochum.de (localhost [127.0.0.1]) by mx2.mail.ruhr-uni-bochum.de (Postfix idis) with ESMTP id 4JRJhl0Kdhz8S6j; Sun, 2 Jan 2022 00:52:23 +0100 (CET) X-RUB-Notes: Internal origin=IPv6:2a05:3e00:c:1001::8693:2aec X-Envelope-Sender: Received: from mail2.mail.ruhr-uni-bochum.de (mail2.mail.ruhr-uni-bochum.de [IPv6:2a05:3e00:c:1001::8693:2aec]) by out2.mail.ruhr-uni-bochum.de (Postfix mi-int) with ESMTP id 4JRJhk6DGCz8S55; Sun, 2 Jan 2022 00:52:22 +0100 (CET) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.104.1 at mx2.mail.ruhr-uni-bochum.de Received: from think.local (dslb-002-204-223-044.002.204.pools.vodafone-ip.de [2.204.223.44]) by mail2.mail.ruhr-uni-bochum.de (Postfix) with ESMTPSA id 4JRJhk4G7VzDgyZ; Sun, 2 Jan 2022 00:52:22 +0100 (CET) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.104.1 at mail2.mail.ruhr-uni-bochum.de Date: Sun, 2 Jan 2022 00:51:51 +0100 Message-Id: <20220101235155.5754-9-daniel.meissner-i4k@ruhr-uni-bochum.de> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220101235155.5754-1-daniel.meissner-i4k@ruhr-uni-bochum.de> References: <20220101235155.5754-1-daniel.meissner-i4k@ruhr-uni-bochum.de> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Daniel =?utf-8?q?Mei=C3=9Fner?= X-ACL-Warn: , =?utf-8?q?Daniel_Mei=C3=9Fner_via_Guix-patches?= X-Patchwork-Original-From: =?utf-8?q?Daniel_Mei=C3=9Fner_via_Guix-patches?= via From: =?utf-8?q?Daniel_Mei=C3=9Fner?= X-getmail-retrieved-from-mailbox: Patches * gnu/packages/python-xyz.scm (python-moderngl-window): New variable. --- gnu/local.mk | 1 + .../python-moderngl-window-skip-tests.patch | 146 ++++++++++++++++++ gnu/packages/python-xyz.scm | 44 ++++++ 3 files changed, 191 insertions(+) create mode 100644 gnu/packages/patches/python-moderngl-window-skip-tests.patch diff --git a/gnu/local.mk b/gnu/local.mk index 852f9f3246..ff3e80ea68 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1685,6 +1685,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-magic-python-bytecode.patch \ %D%/packages/patches/python-matplotlib-run-under-wayland-gtk3.patch \ %D%/packages/patches/python-memcached-syntax-warnings.patch \ + %D%/packages/patches/python-moderngl-window-skip-tests.patch \ %D%/packages/patches/python-mox3-python3.6-compat.patch \ %D%/packages/patches/python-typing-inspect-fix.patch \ %D%/packages/patches/python-packaging-test-arch.patch \ diff --git a/gnu/packages/patches/python-moderngl-window-skip-tests.patch b/gnu/packages/patches/python-moderngl-window-skip-tests.patch new file mode 100644 index 0000000000..aee4b71e2a --- /dev/null +++ b/gnu/packages/patches/python-moderngl-window-skip-tests.patch @@ -0,0 +1,146 @@ +Skip failing tests and tests for optional dependencies + +The Python packages pywavefront and trimesh are optional dependencies and not +yet packaged in Guix but the tests try to load the modules anyway. Therefore +skip them. + +The tests test_texture_mimpamps, test_texture_abspath, test_load_texture_2d +and test_load_texture_array fail when Guix builds the package. This is not +the case when running the tests directly from a source tree. + +diff --git a/tests/test_docs.py b/tests/test_docs.py +index e4a38df..99a2aa0 100644 +--- a/tests/test_docs.py ++++ b/tests/test_docs.py +@@ -133,20 +133,11 @@ class TestCase(unittest.TestCase): + + # --- Loaders : Scene --- + +- def test_loaders_wavefront(self): +- self.validate('loaders/wavefront.rst', 'moderngl_window.loaders.scene.wavefront', 'Loader') +- + def test_loaders_gltf(self): + self.validate('loaders/gltf2.rst', 'moderngl_window.loaders.scene.gltf2', 'Loader') + +- def test_loaders_stl(self): +- self.validate('loaders/wavefront.rst', 'moderngl_window.loaders.scene.stl', 'Loader') +- + # --- Loaders : Program --- + +- def test_loader_single(self): +- self.validate('loaders/single.rst', 'moderngl_window.loaders.program.single', 'Loader') +- + def test_loader_separate(self): + self.validate('loaders/separate.rst', 'moderngl_window.loaders.program.separate', 'Loader') + +diff --git a/tests/test_loaders_scene.py b/tests/test_loaders_scene.py +index c577315..2eef889 100644 +--- a/tests/test_loaders_scene.py ++++ b/tests/test_loaders_scene.py +@@ -16,16 +16,6 @@ class SceneLoadersTestCase(HeadlessTestCase): + window_size = (16, 16) + aspect_ratio = 1.0 + +- def test_wavefront(self): +- """Load wavefront file""" +- scene = resources.scenes.load(SceneDescription(path='scenes/crate/crate.obj')) +- self.assertIsInstance(scene, Scene) +- +- def test_wavefont_not_found(self): +- """Ensure ImproperlyConfigured is raised when wavefront is not found""" +- with self.assertRaises(ImproperlyConfigured): +- resources.scenes.load(SceneDescription(path='scenes/doesnotexist.obj')) +- + def test_gltf(self): + """Load standard gltf""" + scene = resources.scenes.load(SceneDescription(path='scenes/BoxTextured/glTF/BoxTextured.gltf')) +@@ -45,7 +35,3 @@ class SceneLoadersTestCase(HeadlessTestCase): + """Attempt to load nonexisting gltf""" + with self.assertRaises(ImproperlyConfigured): + resources.scenes.load(SceneDescription(path='scenes/doesnotexist.gltf')) +- +- def test_stl(self): +- scene = resources.scenes.load(SceneDescription(path='scenes/uplink.stl')) +- self.assertIsInstance(scene, Scene) +diff --git a/tests/test_loaders_texture.py b/tests/test_loaders_texture.py +index fcd4d72..8e13037 100644 +--- a/tests/test_loaders_texture.py ++++ b/tests/test_loaders_texture.py +@@ -55,39 +55,3 @@ class TextureLoadersTestCase(HeadlessTestCase): + kind='cube', + )) + self.assertIsInstance(texture, moderngl.TextureCube) +- +- def test_texture_mimpamps(self): +- """Load texture with mipmapping and anisotropy""" +- desc = TextureDescription( +- path='textures/crate.png', +- mipmap_levels=(0, 2), +- anisotropy=4.0, +- ) +- texture = resources.textures.load(desc) +- self.assertEqual(texture.anisotropy, 4.0) +- self.assertEqual(desc.mipmap, True) +- +- # Texture Array +- desc = TextureDescription( +- path='textures/array.png', +- kind="array", +- layers=10, +- mipmap_levels=(0, 5), +- anisotropy=8.0, +- ) +- texture = resources.textures.load(desc) +- self.assertEqual(texture.anisotropy, 8.0) +- self.assertEqual(desc.mipmap, True) +- +- def test_texture_abspath(self): +- """Strip search directories and use absolute path""" +- path = (Path(__file__).parent / "fixtures/resources/textures/crate.png").resolve() +- with resources.temporary_dirs([]): +- desc = TextureDescription( +- path=path, +- mipmap_levels=(0, 2), +- anisotropy=4.0, +- ) +- texture = resources.textures.load(desc) +- self.assertEqual(texture.anisotropy, 4.0) +- self.assertEqual(desc.mipmap, True) +diff --git a/tests/test_windowconfig.py b/tests/test_windowconfig.py +index 185c36e..2eb6f39 100644 +--- a/tests/test_windowconfig.py ++++ b/tests/test_windowconfig.py +@@ -94,31 +94,6 @@ class WindowConfigTestCase(WindowConfigTestCase): + with self.assertRaises(ValueError): + self.window.resize_func = "Hello" + +- def test_load_texture_2d(self): +- """Load texture with shortcut method""" +- texture = self.config.load_texture_2d( +- "textures/crate.png", +- flip=True, +- mipmap_levels=(0, 2), +- anisotropy=4.0, +- ) +- self.assertIsInstance(texture, moderngl.Texture) +- self.assertEqual(texture.anisotropy, 4.0) +- +- def test_load_texture_array(self): +- """Load texture array with shortcut method""" +- texture = self.config.load_texture_array( +- 'textures/array.png', +- layers=10, +- flip=True, +- mipmap=False, +- mipmap_levels=(0, 2), +- anisotropy=4.0, +- ) +- self.assertIsInstance(texture, moderngl.TextureArray) +- self.assertEqual(texture.anisotropy, 4.0) +- self.assertEqual(texture.layers, 10) +- + def test_load_program_single(self): + """Load a single glsl program""" + prog = self.config.load_program(path='programs/white.glsl') +-- +2.33.0 diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 0dbc9db830..eee2fc0077 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19710,6 +19710,50 @@ (define-public python-pyglet music. All of this with a friendly Pythonic API that's simple to learn.") (license license:bsd-3))) +(define-public python-moderngl-window + (package + (name "python-moderngl-window") + (version "2.4.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/moderngl/moderngl-window") + (commit version))) + (file-name (git-file-name name version)) + (patches + (search-patches "python-moderngl-window-skip-tests.patch")) + (sha256 + (base32 + "1fvhm6ln3q5kl5m5q3gzfmx1kpyn054fhpcrgpqz8809dxi7pzcv")))) + (build-system python-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-before 'check 'fix-test + (lambda _ + (substitute* '("tests/test_windowconfig.py") + (("terrain_Vs.glsl") "terrain_vs.glsl")))) + (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" ))))))) + (propagated-inputs + (list python-pillow python-pyrr python-numpy python-moderngl + python-pyglet)) + (native-inputs + (list python-pytest xorg-server-for-tests)) + (home-page "https://github.com/moderngl/moderngl-window") + (synopsis "Cross-platform utility library for ModernGL") + (description "This ModernGL utility library simplifies window creation and +resource loading. You can create a window for ModernGL using pyglet, pygame, +PySide2, GLFW, SDL2, PyQt5 or tkinter. Events are unified into a single event +system. Resource loading includes loading of 2D textures/texture arrays, +shaders and objects/scenes.") + (license license:expat))) + (define-public python-screeninfo (package (name "python-screeninfo")