From patchwork Tue Jun 14 23:13:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jean Pierre De Jesus DIAZ X-Patchwork-Id: 40012 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 4B67227BBEA; Wed, 15 Jun 2022 00:28:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 9714E27BBE9 for ; Wed, 15 Jun 2022 00:28:23 +0100 (BST) Received: from localhost ([::1]:47286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1FxO-0007V6-8O for patchwork@mira.cbaines.net; Tue, 14 Jun 2022 19:28:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1Fx6-0007Uv-0m for guix-patches@gnu.org; Tue, 14 Jun 2022 19:28:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:42166) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1Fx4-0000LP-PJ for guix-patches@gnu.org; Tue, 14 Jun 2022 19:28:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o1Fx4-0005tK-Fc for guix-patches@gnu.org; Tue, 14 Jun 2022 19:28:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55893] [PATCH] gnu: python-xyz: Add python-pysdl2. Resent-From: Jean Pierre De Jesus DIAZ Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 14 Jun 2022 23:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55893 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: "55893@debbugs.gnu.org" <55893@debbugs.gnu.org> Received: via spool by 55893-submit@debbugs.gnu.org id=B55893.165524924122595 (code B ref 55893); Tue, 14 Jun 2022 23:28:02 +0000 Received: (at 55893) by debbugs.gnu.org; 14 Jun 2022 23:27:21 +0000 Received: from localhost ([127.0.0.1]:36063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1FwO-0005sM-8k for submit@debbugs.gnu.org; Tue, 14 Jun 2022 19:27:21 -0400 Received: from mail-4323.proton.ch ([185.70.43.23]:24423) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1Fj9-0005Y0-Kj for 55893@debbugs.gnu.org; Tue, 14 Jun 2022 19:13:44 -0400 Date: Tue, 14 Jun 2022 23:13:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jeandudey.tech; s=protonmail3; t=1655248412; x=1655507612; bh=fSb7JNRTlr6U5IrZnmwveBSkOR+E2D8bvQ4hGvQj634=; h=Date:To:From:Reply-To:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID; b=R2IKY3jzBFmVYwPnaslIbLHzeMiiRan4Swo7AamDDFwMjCmj2Q+3BF1q6SHDIWFpE OiOdSl/ZlrSDzLnFMOTX5fIwPFGIQxysjC4dvAd853QfEQGbtGtoE7CyqrHWRttBfB by4VfzQFysv6xmCc8fGPUKj7PMqtyhKWFcFf0JWqHAm3uNznSV65uMqLfUTklz+OQI AFt+CaOf8+MMOnStNMFhGYlVruRpLxbuIoKXZ3MA5LdrbxBhayAIvGWAYjBwxMM0Rk eX+/8HsOoxtkPwC8KjXUfWdTLZVdxfYdKmuLYNuFtHvspDg7b4jtxaifRCruItNkEs BWb0w7JPf/vKg== Message-ID: In-Reply-To: References: <53cab9bbd3f482ad08fef4159bcefbf8e9ac0af5.camel@telenet.be> Feedback-ID: 20187791:user:proton MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jun 2022 19:27:19 -0400 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: Jean Pierre De Jesus DIAZ X-ACL-Warn: , Jean Pierre De Jesus DIAZ via Guix-patches X-Patchwork-Original-From: Jean Pierre De Jesus DIAZ via Guix-patches via From: Jean Pierre De Jesus DIAZ X-getmail-retrieved-from-mailbox: Patches Applied the suggestions to the code and relocated the definition of the package on the `python-py` packages section. Thanks for the review. > ------- Original Message ------- > On Saturday, June 11th, 2022 at 12:13 AM, Maxime Devos maximedevos@telenet.be wrote: > > > > > Jean Pierre De Jesus DIAZ via Guix-patches via schreef op vr 10-06-2022 > > om 18:09 [+0000]: > > > > > + (native-inputs > > > + (list sdl2 sdl2-image sdl2-gfx sdl2-mixer sdl2-ttf)) > > > > These need to be in 'inputs', not native-inputs -- their shared > > libraries will actually be executed when python-pysdl2 executed, which > > can only work if they are compiled for the same architecture as python- > > pysdl2 is compiled for (that's what 'inputs' means; for 'native- > > inputs', it would be compiled for the architecture on which python- > > pysdl2 is compiled, not the architecture it is compiled for). > > > > > + (synopsis "Python ctypes wrapper around SDL2") > > > > ctypes sounds like an implementation detail not relevant to users of > > python-pysdl2, maybe: ‘Python bindings around SDL2’? > > > > > + ; Disable pysdl2-dll. Not needed. > > > > Nitpick: the convention is two ;;, not a single ;. > > > > > + (string-append "DLL(\"SDL2\", [\"SDL2\", \"SDL2 > > > > 2.0\"," > > > > > + "\"SDL2-2.0.0\"], " > > > + "\"" > > > > Thee strings above can be combined. > > > > > + (dirname > > > + (search-input-file inputs > > > + "/lib/libSDL2.so")) > > > > Indentations seems a bit wonky -- if this is to not make the line too long, > > maybe try putting a line break between the 'string-append' and the "DLL(..."? > > > > > + "\"" > > > + ")"))) > > > > These strings too. > > > > > + (arguments > > > + `(#:tests? #f ; Requires /dev/dri, OpenGL module, etc. > > > + #:phases > > > + (modify-phases %standard-phases > > > > Recommended style (considered more readable): > > > > (list #:tests? #f ; etcetera > > #:phases > > #~(modify-phases [etcetera])) > > > > (Many other packages don't do it like that yet, it has only > > be discovered recently -- I would point you at IRC logs but > > I'm currently offline.) > > > > Also, don't put the package definition simply at the end, that > > leads to merge conflicts. Instead, try keep packages > > alphabetical ... which is difficult here, because it has > > historically neglected alphebetical ordening, but maybe right > > after python-py would be a good fit? > > > > Otherwise, the package definition LGTM from a distance, though > > I only looked at the definition, I didn't check the source code > > (for simplifying the substitute*-ions or checking for malware) > > or build it. > > > > Greetings, > > Maxime. From 542a138fa26eec2c25cb7743be612a2d7f4a502d Mon Sep 17 00:00:00 2001 Message-Id: <542a138fa26eec2c25cb7743be612a2d7f4a502d.1655242487.git.me@jeandudey.tech> From: Jean-Pierre De Jesus DIAZ Date: Fri, 10 Jun 2022 19:57:31 +0200 Subject: [PATCH] gnu: python-xyz: Add python-pysdl2. * gnu/packages/python-xyz.scm (python-pysdl2): Add package. --- gnu/packages/python-xyz.scm | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index f37ca731d5..dbc662465b 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -123,6 +123,7 @@ ;;; Copyright © 2022 Jai Vetrivelan ;;; Copyright © 2022 Artyom V. Poptsov ;;; Copyright © 2022 Paul A. Patience +;;; Copyright © 2022 Jean-Pierre De Jesus DIAZ ;;; ;;; This file is part of GNU Guix. ;;; @@ -3900,6 +3901,71 @@ (define-public python-jinja2-time 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 SDL2") + (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") -- 2.36.1