On Fri, Sep 10 2021, Daniel Meißner via Guix-patches via wrote: > * gnu/packages/python-xyz.scm (python-glcontext): New variable. > --- > gnu/packages/python-xyz.scm | 46 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 46 insertions(+) > > diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm > index 75646aec7f..251aad5b61 100644 > --- a/gnu/packages/python-xyz.scm > +++ b/gnu/packages/python-xyz.scm > @@ -18884,6 +18884,52 @@ library.") > (description > "This is the Cython-coded accelerator module for PyOpenGL."))) > > +(define-public python-glcontext > + (package > + (name "python-glcontext") > + (version "2.3.4") > + (source > + (origin > + (method git-fetch) > + (uri (git-reference > + (url "https://github.com/moderngl/glcontext") > + (commit version))) > + (file-name (git-file-name name version)) > + (sha256 > + (base32 > + "1m2zkl696vqmgrd5k1c5kl0krk6qgjgsz88qhahwva0l40bswvhp")))) > + (build-system python-build-system) > + (arguments > + '(#:phases > + (modify-phases %standard-phases > + (add-before 'build 'fix-lib-paths > + (lambda* (#:key inputs outputs #:allow-other-keys) > + (substitute* '("glcontext/x11.cpp" "glcontext/egl.cpp") > + (("\"libGL.so\"") > + (string-append "\"" (assoc-ref inputs "mesa") "/lib/libGL.so\"")) > + (("\"libEGL.so\"") > + (string-append "\"" (assoc-ref inputs "mesa") "/lib/libEGL.so\"")) > + (("\"libX11.so\"") > + (string-append "\"" (assoc-ref inputs "libx11") "/lib/libX11.so\""))) Please keep lines =<80 columns wide. Also I would use a ‘let’ form to avoid writing (assoc-ref inputs "mesa") twice. > + (substitute* '("glcontext/__init__.py") > + (("find_library\\('GL'\\)") > + (string-append "'" (assoc-ref inputs "mesa") "/lib/libGL.so'")) > + (("find_library\\('EGL'\\)") > + (string-append "'" (assoc-ref inputs "mesa") "/lib/libEGL.so'")) Likewise (‘let’ form). > + (("find_library\\(\"X11\"\\)") > + (string-append "'" (assoc-ref inputs "libx11") "/lib/libX11.so'"))) > + #t)) Phases don’t need to return #t once the ‘core-updates-frozen’ branch gets merged, which should happen soon™. :-) > + ;; tests fail with: Exception: (standalone) XOpenDisplay: cannot open display > + (delete 'check)))) > + (inputs > + `(("libx11" ,libx11) > + ("mesa" ,mesa))) > + (home-page "https://github.com/moderngl/glcontext") > + (synopsis "Portable OpenGL Context for ModernGL") > + (description "Python-glcontext is a library providing OpenGL implementation > +for ModernGL on multiple platforms.") “providing an OpenGL implementation” (missing article).