unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#34571] [PATCH] Add micropython
@ 2019-02-19  9:22 Efraim Flashner
  2019-02-19  9:46 ` Danny Milosavljevic
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Efraim Flashner @ 2019-02-19  9:22 UTC (permalink / raw)
  To: 34571


[-- Attachment #1.1: Type: text/plain, Size: 396 bytes --]

I was looking around to see if there was an alternate perl
implementation and I ended up packaging micropython. I have no
preference between it being in python.scm or embedded.scm

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #1.2: 0001-gnu-Add-micropython.patch --]
[-- Type: text/plain, Size: 2808 bytes --]

From fef607e04b951e7a893139f9afd0a0df3a2b8a52 Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Tue, 19 Feb 2019 11:20:02 +0200
Subject: [PATCH] gnu: Add micropython.

* gnu/packages/python.scm (micropython): New variable.
---
 gnu/packages/python.scm | 46 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 1c4ea720f..e5beac2ec 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -459,3 +459,49 @@ instead of @command{python3}.")))
 
 (define-public python-wrapper (wrap-python3 python))
 (define-public python-minimal-wrapper (wrap-python3 python-minimal))
+
+(define-public micropython
+  (package
+    (name "micropython")
+    (version "1.10")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "https://github.com/micropython/micropython/"
+                            "releases/download/v" version
+                            "/micropython-" version ".tar.gz"))
+        (sha256
+         (base32
+          "1g1zjip3rkx6bp16qi1bag72wivnbh56fcsl3nffanrx4j5f4z90"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'preprare-build
+           (lambda _
+             (chdir "ports/unix")
+             ;; see: https://github.com/micropython/micropython/pull/4246
+             (substitute* "Makefile"
+               (("-Os") "-Os -ffp-contract=off"))
+             #t))
+         (delete 'configure)) ; no configure
+       #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
+                          "V=1")
+       #:test-target "test"))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("python" ,python-minimal-wrapper)))
+    (inputs
+     `(("libffi" ,libffi)))
+    (home-page "https://micropython.org/")
+    (synopsis "Python implementation for microcontrollers and constrained systems")
+    (description "MicroPython is a lean and efficient implementation of the
+Python 3 programming language that includes a small subset of the Python
+standard library and is optimised to run on microcontrollers and in constrained
+environments.  MicroPython is packed full of advanced features such as an
+interactive prompt, arbitrary precision integers, closures, list comprehension,
+generators, exception handling and more.  Still it is compact enough to fit and
+run within just 256k of code space and 16k of RAM.  MicroPython aims to be as
+compatible with normal Python as possible to allow you to transfer code with
+ease from the desktop to a microcontroller or embedded system.")
+    (license license:expat)))
-- 
2.20.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [bug#34571] [PATCH] Add micropython
  2019-02-19  9:22 [bug#34571] [PATCH] Add micropython Efraim Flashner
@ 2019-02-19  9:46 ` Danny Milosavljevic
  2019-02-19 10:10   ` Efraim Flashner
  2019-02-19 13:02 ` Ricardo Wurmus
  2019-02-20  7:10 ` bug#34571: " Efraim Flashner
  2 siblings, 1 reply; 6+ messages in thread
From: Danny Milosavljevic @ 2019-02-19  9:46 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: 34571

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

Hi Erfraim,

On Tue, 19 Feb 2019 11:22:16 +0200
Efraim Flashner <efraim@flashner.co.il> wrote:

> I was looking around to see if there was an alternate perl
> implementation and I ended up packaging micropython. I have no
> preference between it being in python.scm or embedded.scm

Heh :)

There's a bundled version of FreeRTOS in ./ports/cc3200 which is GPLv2
with a modification.

In this case, I suggest to delete FreeRTOS since we don't use it
anyway--and if we ever wanted to, we'd not use the bundled version.
So in a sense I suggest to unbundle it.

We could also just add GPLv2 with exception to the license list,
but in this case I wouldn't--since it doesn't really apply to the
installed version and we don't use it anyhow.

Also, there's a bundled copy of libffi in lib.  Usually, I delete
it to make sure it's not picked up by accident.

Otherwise LGTM!

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* [bug#34571] [PATCH] Add micropython
  2019-02-19  9:46 ` Danny Milosavljevic
@ 2019-02-19 10:10   ` Efraim Flashner
  2019-02-19 10:37     ` Efraim Flashner
  0 siblings, 1 reply; 6+ messages in thread
From: Efraim Flashner @ 2019-02-19 10:10 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 34571

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

On Tue, Feb 19, 2019 at 10:46:40AM +0100, Danny Milosavljevic wrote:
> Hi Erfraim,
> 
> On Tue, 19 Feb 2019 11:22:16 +0200
> Efraim Flashner <efraim@flashner.co.il> wrote:
> 
> > I was looking around to see if there was an alternate perl
> > implementation and I ended up packaging micropython. I have no
> > preference between it being in python.scm or embedded.scm
> 
> Heh :)
> 
> There's a bundled version of FreeRTOS in ./ports/cc3200 which is GPLv2
> with a modification.
> 
> In this case, I suggest to delete FreeRTOS since we don't use it
> anyway--and if we ever wanted to, we'd not use the bundled version.
> So in a sense I suggest to unbundle it.
> 
> We could also just add GPLv2 with exception to the license list,
> but in this case I wouldn't--since it doesn't really apply to the
> installed version and we don't use it anyhow.

I'll go ahead and remove it.

> 
> Also, there's a bundled copy of libffi in lib.  Usually, I delete
> it to make sure it's not picked up by accident.
> 
Looking at the .gitmodules¹ it looks like there's a number of bundled
librarires in the lib folder. With all of them removed it no longer
builds. Looks like I need to take another look at it.

I also switched python-minimal-wrapper -> python-wrapper



¹ https://github.com/micropython/micropython/blob/v1.10/.gitmodules

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [bug#34571] [PATCH] Add micropython
  2019-02-19 10:10   ` Efraim Flashner
@ 2019-02-19 10:37     ` Efraim Flashner
  0 siblings, 0 replies; 6+ messages in thread
From: Efraim Flashner @ 2019-02-19 10:37 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 34571


[-- Attachment #1.1: Type: text/plain, Size: 1746 bytes --]

On Tue, Feb 19, 2019 at 12:10:59PM +0200, Efraim Flashner wrote:
> On Tue, Feb 19, 2019 at 10:46:40AM +0100, Danny Milosavljevic wrote:
> > Hi Erfraim,
> > 
> > On Tue, 19 Feb 2019 11:22:16 +0200
> > Efraim Flashner <efraim@flashner.co.il> wrote:
> > 
> > > I was looking around to see if there was an alternate perl
> > > implementation and I ended up packaging micropython. I have no
> > > preference between it being in python.scm or embedded.scm
> > 
> > Heh :)
> > 
> > There's a bundled version of FreeRTOS in ./ports/cc3200 which is GPLv2
> > with a modification.
> > 
> > In this case, I suggest to delete FreeRTOS since we don't use it
> > anyway--and if we ever wanted to, we'd not use the bundled version.
> > So in a sense I suggest to unbundle it.
> > 
> > We could also just add GPLv2 with exception to the license list,
> > but in this case I wouldn't--since it doesn't really apply to the
> > installed version and we don't use it anyhow.
> 
> I'll go ahead and remove it.
> 
> > 
> > Also, there's a bundled copy of libffi in lib.  Usually, I delete
> > it to make sure it's not picked up by accident.
> > 
> Looking at the .gitmodules¹ it looks like there's a number of bundled
> librarires in the lib folder. With all of them removed it no longer
> builds. Looks like I need to take another look at it.
> 
> I also switched python-minimal-wrapper -> python-wrapper
> 
> ¹ https://github.com/micropython/micropython/blob/v1.10/.gitmodules
> 

I have a new version attached

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #1.2: 0001-gnu-Add-micropython.patch --]
[-- Type: text/plain, Size: 3560 bytes --]

From a8cc300d4d2ae55554ac29a840357b775105ed29 Mon Sep 17 00:00:00 2001
From: Efraim Flashner <efraim@flashner.co.il>
Date: Tue, 19 Feb 2019 11:20:02 +0200
Subject: [PATCH] gnu: Add micropython.

* gnu/packages/python.scm (micropython): New variable.
---
 gnu/packages/python.scm | 62 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 1c4ea720f..25f2ffa73 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -459,3 +459,65 @@ instead of @command{python3}.")))
 
 (define-public python-wrapper (wrap-python3 python))
 (define-public python-minimal-wrapper (wrap-python3 python-minimal))
+
+(define-public micropython
+  (package
+    (name "micropython")
+    (version "1.10")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "https://github.com/micropython/micropython/"
+                            "releases/download/v" version
+                            "/micropython-" version ".tar.gz"))
+        (sha256
+         (base32
+          "1g1zjip3rkx6bp16qi1bag72wivnbh56fcsl3nffanrx4j5f4z90"))
+      (modules '((guix build utils)))
+      (snippet
+       '(begin
+          (delete-file-recursively "ports/cc3200/FreeRTOS")
+          (with-directory-excursion "lib"
+            ;; TODO: Unbundle axtls and berkley-db-1.xx
+            (for-each delete-file-recursively
+                      '("libffi" "lwip" "stm32lib" "nrfx")))
+          #t))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'preprare-build
+           (lambda _
+             (chdir "ports/unix")
+             ;; see: https://github.com/micropython/micropython/pull/4246
+             (substitute* "Makefile"
+               (("-Os") "-Os -ffp-contract=off"))
+             #t))
+         (replace 'install-license-files
+           ;; We don't build in the root directory so the file isn't found.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out  (assoc-ref outputs "out"))
+                    (dest (string-append out "/share/doc/" ,name "-" ,version "/")))
+               (install-file "../../LICENSE" dest))
+             #t))
+         (delete 'configure)) ; no configure
+       #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
+                          "V=1")
+       #:test-target "test"))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("python" ,python-wrapper)))
+    (inputs
+     `(("libffi" ,libffi)))
+    (home-page "https://micropython.org/")
+    (synopsis "Python implementation for microcontrollers and constrained systems")
+    (description "MicroPython is a lean and efficient implementation of the
+Python 3 programming language that includes a small subset of the Python
+standard library and is optimised to run on microcontrollers and in constrained
+environments.  MicroPython is packed full of advanced features such as an
+interactive prompt, arbitrary precision integers, closures, list comprehension,
+generators, exception handling and more.  Still it is compact enough to fit and
+run within just 256k of code space and 16k of RAM.  MicroPython aims to be as
+compatible with normal Python as possible to allow you to transfer code with
+ease from the desktop to a microcontroller or embedded system.")
+    (license license:expat)))
-- 
2.20.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [bug#34571] [PATCH] Add micropython
  2019-02-19  9:22 [bug#34571] [PATCH] Add micropython Efraim Flashner
  2019-02-19  9:46 ` Danny Milosavljevic
@ 2019-02-19 13:02 ` Ricardo Wurmus
  2019-02-20  7:10 ` bug#34571: " Efraim Flashner
  2 siblings, 0 replies; 6+ messages in thread
From: Ricardo Wurmus @ 2019-02-19 13:02 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: 34571


Efraim Flashner <efraim@flashner.co.il> writes:

> I was looking around to see if there was an alternate perl
> implementation and I ended up packaging micropython. I have no
> preference between it being in python.scm or embedded.scm

“python.scm” seems fine.

> +         (add-before 'build 'preprare-build

Typo: preprare –> prepare

> +           (lambda _
> +             (chdir "ports/unix")
> +             ;; see: https://github.com/micropython/micropython/pull/4246
> +             (substitute* "Makefile"
> +               (("-Os") "-Os -ffp-contract=off"))
> +             #t))
> +         (delete 'configure)) ; no configure
> +       #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
> +                          "V=1")
> +       #:test-target "test"))
> +    (native-inputs
> +     `(("pkg-config" ,pkg-config)
> +       ("python" ,python-minimal-wrapper)))

Oh, this Python needs Python…?  I think you should be using
python-wrapper here as the python-minimal variants are merely supposed
to be used for breaking a cycle in the build of Python itself.

--
Ricardo

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

* bug#34571: [PATCH] Add micropython
  2019-02-19  9:22 [bug#34571] [PATCH] Add micropython Efraim Flashner
  2019-02-19  9:46 ` Danny Milosavljevic
  2019-02-19 13:02 ` Ricardo Wurmus
@ 2019-02-20  7:10 ` Efraim Flashner
  2 siblings, 0 replies; 6+ messages in thread
From: Efraim Flashner @ 2019-02-20  7:10 UTC (permalink / raw)
  To: 34571-done

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

pushed as 20801f9da8cd8669837c4cf6dc633792be53a9f0

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2019-02-20  7:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-19  9:22 [bug#34571] [PATCH] Add micropython Efraim Flashner
2019-02-19  9:46 ` Danny Milosavljevic
2019-02-19 10:10   ` Efraim Flashner
2019-02-19 10:37     ` Efraim Flashner
2019-02-19 13:02 ` Ricardo Wurmus
2019-02-20  7:10 ` bug#34571: " Efraim Flashner

Code repositories for project(s) associated with this public 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).