unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#47459] [PATCH] gnu: Add brython.
@ 2021-03-29  4:23 jgart via Guix-patches via
  2021-04-01 12:26 ` Ludovic Courtès
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: jgart via Guix-patches via @ 2021-03-29  4:23 UTC (permalink / raw)
  To: 47459; +Cc: lle-bout, rprior, a.pierre

[-- Attachment #1: Type: text/plain, Size: 141 bytes --]

Hi Guix!

Here is brython. Thank you!

This was an effort of today's Guix Packaging Meetup.

best regards,

jgart

libremiami.org

[-- Attachment #2: 0002-gnu-Add-brython.patch --]
[-- Type: application/octet-stream, Size: 3288 bytes --]

From 519c8d5e5369744cadbe4bc7607b0c4c8f05128a Mon Sep 17 00:00:00 2001
From: LibreMiami <packaging-guix@libremiami.org>
Date: Sun, 28 Mar 2021 21:13:31 -0400
Subject: [PATCH 2/2] gnu: Add brython.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* gnu/packages/web.scm (brython): New variable.

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

diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index ae41588037..2271592aec 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -8155,3 +8155,61 @@ provided by a TLS reverse proxy (e.g. tlstunnel, hitch or stunnel).")
       ;; "cpe:2.3:a:comelz:quark" package.  The proper fix is for (guix cve)
       ;; to account for "vendor names".
       (properties '((lint-hidden-cve . ("CVE-2019-15520")))))))
+
+(define-public brython
+  (package
+    (name "brython")
+    (version "3.9.1")
+    (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
+            "1rv9az92kl3y079ck0jfdp21p184qgyhqdiil3hk2fd2c5r3s8n2"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(; 'install phase needs the python command
+       ("python" ,((package-input-rewriting
+                    `((,python . ,python-3.9))
+                    #:deep? #f) python-wrapper))))
+    (arguments
+     `(#:python ,python-3.9 ; required during build
+       #:tests? #f ; tests require npm packages
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; write access is required to .js files for minifying
+             (for-each
+              (lambda (vv) (chmod vv #o644))
+              (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
+             ;; release tag contains an older python egg version
+             (substitute* (find-files "setup" "\\.py$")
+               (("3\\.9\\.0") "3.9.1"))
+
+             ;; 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)))
-- 
2.31.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#47459] [PATCH] gnu: Add brython.
  2021-03-29  4:23 [bug#47459] [PATCH] gnu: Add brython jgart via Guix-patches via
@ 2021-04-01 12:26 ` Ludovic Courtès
  2021-07-05 19:48 ` [bug#47459] [PATCH] * gnu/packages/web.scm (brython): New variable jgart via Guix-patches via
  2021-07-05 22:29 ` [bug#47459] brython bump to 3.9.5 and fixes for core-updates branch jgart via Guix-patches via
  2 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2021-04-01 12:26 UTC (permalink / raw)
  To: jgart; +Cc: 47459, lle-bout, rprior, a.pierre

Hi,

"jgart" <jgart@dismail.de> skribis:

> This was an effort of today's Guix Packaging Meetup.

Nice!

> From 519c8d5e5369744cadbe4bc7607b0c4c8f05128a Mon Sep 17 00:00:00 2001
> From: LibreMiami <packaging-guix@libremiami.org>
> Date: Sun, 28 Mar 2021 21:13:31 -0400
> Subject: [PATCH 2/2] gnu: Add brython.
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> * gnu/packages/web.scm (brython): New variable.
>
> Co-authored-by: Léo Le Bouter <lle-bout@zaclys.net>
> Co-authored-by: jgart <jgart@dismail.de>
> Co-authored-by: Ryan Prior <rprior@protonmail.com>
> Co-authored-by: Andrea Pierré <a.pierre@zaclys.net>

[...]

> +    (native-inputs
> +     `(; 'install phase needs the python command
> +       ("python" ,((package-input-rewriting
> +                    `((,python . ,python-3.9))
> +                    #:deep? #f) python-wrapper))))

That’s likely to perform very poorly.  Normally, you’d save the result
of ‘package-input-rewriting’ (a procedure) in a variable and reuse it
anytime you need to make that transformation, so that caching can kick
in.

> +    (arguments
> +     `(#:python ,python-3.9 ; required during build

In current ‘master’, all Python 3.x package are built against 3.8.  I
think we should stick to that and not introduce different dependencies
as this can only lead to bad surprises.

Can Brython be built against 3.8?  If not, I think it’ll have to go to
the ‘core-updates’ branch, which may be merged soon after the release
(end of April).

WDYT?

> +           (lambda* (#:key outputs #:allow-other-keys)
> +             ;; write access is required to .js files for minifying

Nitpick: Please capitalize sentences and end with a period (here and
elsewhere).

> +             (for-each
> +              (lambda (vv) (chmod vv #o644))

Use ‘make-file-writable’ instead of this lambda.

> +             (invoke "python3" "scripts/make_dist.py")
> +             #t))

No need for the trailing #t.

> +    (synopsis
> +      "Run python code in a web browser")

This can be on a single line.

> +    (description
> +      "@code{Brython} is a compliant implementation of Python 3 that allows

You can remove @code here (@code is only used for inline code snippets
and similar things).

Thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#47459] [PATCH] * gnu/packages/web.scm (brython): New variable.
  2021-03-29  4:23 [bug#47459] [PATCH] gnu: Add brython jgart via Guix-patches via
  2021-04-01 12:26 ` Ludovic Courtès
@ 2021-07-05 19:48 ` jgart via Guix-patches via
  2021-07-05 22:29 ` [bug#47459] brython bump to 3.9.5 and fixes for core-updates branch jgart via Guix-patches via
  2 siblings, 0 replies; 5+ messages in thread
From: jgart via Guix-patches via @ 2021-07-05 19:48 UTC (permalink / raw)
  To: 47459
  Cc: jgart, Léo Le Bouter, Ryan Prior, Andrea Pierré, LibreMiami

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 --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")
-- 
2.31.1





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#47459] brython bump to 3.9.5 and fixes for core-updates branch
  2021-03-29  4:23 [bug#47459] [PATCH] gnu: Add brython jgart via Guix-patches via
  2021-04-01 12:26 ` Ludovic Courtès
  2021-07-05 19:48 ` [bug#47459] [PATCH] * gnu/packages/web.scm (brython): New variable jgart via Guix-patches via
@ 2021-07-05 22:29 ` jgart via Guix-patches via
  2022-06-22 19:23   ` [bug#47459] [PATCH] gnu: Add brython Maxim Cournoyer
  2 siblings, 1 reply; 5+ messages in thread
From: jgart via Guix-patches via @ 2021-07-05 22:29 UTC (permalink / raw)
  To: 47459; +Cc: rekado, Ludovic Courtès

Hi Ludo,

Thank you for your suggestions! They are much appreciated. I think I incorporated all of them and
bumped brython from 3.9.1 to 3.9.5 since it's been a while... Sorry for the delay. I hope this patch finds you
well. The above patch was taken from core-updates.

I tried adding a message via the mumi interface but it never went through...




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#47459] [PATCH] gnu: Add brython.
  2021-07-05 22:29 ` [bug#47459] brython bump to 3.9.5 and fixes for core-updates branch jgart via Guix-patches via
@ 2022-06-22 19:23   ` Maxim Cournoyer
  0 siblings, 0 replies; 5+ messages in thread
From: Maxim Cournoyer @ 2022-06-22 19:23 UTC (permalink / raw)
  To: jgart, GNU Debbugs; +Cc: 47459, rekado, Ludovic Courtès

tags 47459 moreinfo
thanks

Hi,

"jgart" <jgart@dismail.de> writes:

> Hi Ludo,
>
> Thank you for your suggestions! They are much appreciated. I think I incorporated all of them and
> bumped brython from 3.9.1 to 3.9.5 since it's been a while... Sorry for the delay. I hope this patch finds you
> well. The above patch was taken from core-updates.
>
> I tried adding a message via the mumi interface but it never went through...

I wanted to merge this in, but as I looked at it, I got curious about
the "source" that is on the heavy side (53 MiB), and saw what look like
generated "source" code:

du -h www/src/py_VFS.js 
4.3M    www/src/py_VFS.js

The file contains section that read like:

--8<---------------cut here---------------start------------->8---
9, 0xFF89,0xCA, 0xFF8A,0xCB, 0xFF8B,0xCC, 0xFF8C,0xCD, 0xFF8D,0xCE, 0xFF8E,0xCF, 0xFF8F,0xD0, 0xFF90,0xD1, 0xFF91,0xD2, 0xFF92,0xD3, 0xFF93,0xD4, 0xFF94,0xD5, 0xFF95,0xD6, 0xFF96,0xD7, 0xFF97,0xD8, 0xFF98,0xD9, 0xFF99,0xDA, 0xFF9A,0xDB, 0xFF9B,0xDC, 0xFF9C,0xDD, 0xFF9D,0xDE, 0xFF9E,0xDF, 0xFF9F,0xE0, -1,0xE1, -1,0xE2, -1,0xE3, -1,0xE4, -1,0xE5, -1,0xE6, -1,0xE7, -1,0xE8, -1,0xE9, -1,0xEA, -1,0xEB, -1,0xEC, -1,0xED, -1,0xEE, -1,0xEF, -1,0xF0, -1,0xF1, -1,0xF2, -1,0xF3, -1,0xF4, -1,0xF5, -1,0xF6, -1,0xF7, -1,0xF8, -1,0xF9, -1,0xFA, -1,0xFB, -1,0xFC, -1,0xFD, -1,0xFE, -1,0xFF, -1,0x8140, 0x3000,0x8141, 0x3001,0x8142, 0x3002,0x8143, 0xFF0C,0x8144, 0xFF0E,0x8145, 0x30FB,0x8146, 0xFF1A,0x8147, 0xFF1B,0x8148, 0xFF1F,0x8149, 0xFF01,0x814A, 0x309B,0x814B, 0x309C,0x814C, 0x00B4,0x814D, 0xFF40,0x814E, 0x00A8,0x814F, 0xFF3E,0x8150, 0xFFE3,0x8151, 0xFF3F,0x8152, 0x30FD,0x8153, 0x30FE,0x8154, 0x309D,0x8155, 0x309E,0x8156, 0x3003,0x8157, 0x4EDD,0x8158, 0x3005,0x8159, 0x3006,0x815A, 0x3007,0x815B, 0x30FC,0x815C, 0x2015,0x815D, 0x2010,0x815E, 0xFF0F,0x815F, 0xFF3C,0x8160, 0xFF5E,0x8161, 0x2225,0x8162, 0xFF5C,0x8163, 0x2026,0x8164, 0x2025,0x8165, 0x2018,0x8166, 0x2019,0x8167, 0x201C,0x8168, 0x201D,0x8169, 0xFF08,0x816A, 0xFF09,0x816B, 0x3014,0x816C, 0x3015,0x816D, 0xFF3B,0x816E, 0xFF3D,0x816F, 0xFF5B,0x8170, 0xFF5D,0x8171, 0x3008,0x8172, 0x3009,0x8173, 0x300A,0x8174, 0x300B,0x8175, 0x300C,0x8176, 0x300D,0x8177, 0x300E,0x8178, 0x300F,0x8179, 0x3010,0x817A, 0x3011,0x817B, 0xFF0B,0x817C, 0xFF0D,0x817D, 0x00B1,0x817E, 0x00D7,0x8180, 0x00F7,0x8181, 0xFF1D,0x8182, 0x2260,0x8183, 0xFF1C,0x8184, 0xFF1E,0x8185, 0x2266,0x8186, 0x2267,0x8187, 0x221E,0x8188, 0x2234,0x8189, 0x2642,0x818A, 0x2640,0x818B, 0x00B0,0x818C, 0x2032,0x818D, 0x2033,0x818E, 0x2103,0x818F, 0xFFE5,0x8190, 0xFF04,0x8191, 0xFFE0,0x8192, 0xFFE1,0x8193, 0xFF05,0x8194, 0xFF03,0x8195, 0xFF06,0x8196, 0xFF0A,0x8197, 0xFF20,0x8198, 0x00A7,0x8199, 0x2606,0x819A, 0x2605,0x819B, 0x25CB,0x819C, 0x25CF,0x819D, 0x25CE,0x819E, 0x25C7,0x819F, 0x25C6,0x81A0, 0x25A1,0x81A1, 0x25A0,0x81A2, 0x25B3,0x81A3, 0x25B2,0x81A4, 0x25BD,0x81A5, 0x25BC,0x81A6, 0x203B,0x81A7, 0x3012,0x81A8, 0x2192,0x81A9, 0x2190,0x81AA, 0x2191,0x81AB, 0x2193,0x81AC, 0x3013,0x81B8, 0x2208,0x81B9, 0x220B,0x81BA, 0x2286,0x81BB, 0x2287,0x81BC, 0x2282,0x81BD, 0x2283,0x81BE, 0x222A,0x81BF, 0x2229,0x81C8,
--8<---------------cut here---------------end--------------->8---

I don't think this qualifies as source code.

Could you look into how these source come into existence?  Otherwise
it's akin to bundling binaries, which we strive to not do in Guix.

Thanks,

Maxim




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-22 19:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29  4:23 [bug#47459] [PATCH] gnu: Add brython jgart via Guix-patches via
2021-04-01 12:26 ` Ludovic Courtès
2021-07-05 19:48 ` [bug#47459] [PATCH] * gnu/packages/web.scm (brython): New variable jgart via Guix-patches via
2021-07-05 22:29 ` [bug#47459] brython bump to 3.9.5 and fixes for core-updates branch jgart via Guix-patches via
2022-06-22 19:23   ` [bug#47459] [PATCH] gnu: Add brython Maxim Cournoyer

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).