diff mbox series

[bug#47459] * gnu/packages/web.scm (brython): New variable.

Message ID 20210705194813.19624-1-jgart@dismail.de
State New
Headers show
Series [bug#47459] * gnu/packages/web.scm (brython): New variable. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

jgart July 5, 2021, 7:48 p.m. UTC
From: LibreMiami <packaging-guix@libremiami.org>

Co-authored-by: Andrea Pierré <a.pierre@zaclys.net>
Co-authored-by: jgart <jgart@dismail.de>
Co-authored-by: Léo Le Bouter <lle-bout@zaclys.net>
Co-authored-by: Ryan Prior <rprior@protonmail.com>
---
 gnu/packages/python-web.scm | 48 +++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index e4d1326fb8..9b692c2ade 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -329,6 +329,54 @@  communicate with each other, and positioned as an asynchronous successor to
 WSGI.  This package includes libraries for implementing ASGI servers.")
     (license license:bsd-3)))
 
+(define-public brython
+  (package
+    (name "brython")
+    (version "3.9.5")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+              (url "https://github.com/brython-dev/brython")
+              (commit version)))
+        (file-name (git-file-name name version))
+        (sha256
+          (base32
+            "0ikxhvgy1zdg8zrdx2bajp1v7r9dhk6v9jan20i05ahvm9s8gfd6"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python" ,python)))
+    (arguments
+     `(#:tests? #f ; tests require npm packages
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; Write access is required for minifying javascript files.
+             (for-each make-file-writable
+                (find-files "." "\\.js$"))
+
+             ;; Patch build scripts to reference source directory properly.
+             (substitute* (find-files "scripts" "\\.py$")
+               (("os\\.path\\.dirname\\(os\\.getcwd\\(\\)\\)")
+                (string-append "\"" (getcwd) "\"")))
+
+             (invoke "python3" "scripts/make_dist.py")
+             #t))
+         (replace 'install
+           (lambda args
+             ;; setup.py is within 'setup' subdirectory
+             (with-directory-excursion "setup"
+               (invoke "python3" "setup.py" "sdist")
+               (apply (assoc-ref %standard-phases 'install) args))
+             #t)))))
+    (home-page "http://brython.info")
+    (synopsis "Run python code in a web browser")
+    (description
+"@code{Brython} is a compliant implementation of Python 3 that allows
+writing end-user applications in Python that run in the browser.")
+    (license license:bsd-3)))
+
 (define-public python-css-html-js-minify
   (package
     (name "python-css-html-js-minify")