From patchwork Tue Feb 19 10:37:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 1194 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 F01F716C63; Tue, 19 Feb 2019 10:39:19 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 650AD16C0F for ; Tue, 19 Feb 2019 10:39:19 +0000 (GMT) Received: from localhost ([127.0.0.1]:45815 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gw2o2-0004SV-PT for patchwork@mira.cbaines.net; Tue, 19 Feb 2019 05:39:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gw2mu-0003yK-Be for guix-patches@gnu.org; Tue, 19 Feb 2019 05:38:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gw2mq-00033U-0R for guix-patches@gnu.org; Tue, 19 Feb 2019 05:38:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:54654) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gw2mo-000332-C8 for guix-patches@gnu.org; Tue, 19 Feb 2019 05:38:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gw2mo-0007eR-3n for guix-patches@gnu.org; Tue, 19 Feb 2019 05:38:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#34571] [PATCH] Add micropython Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 19 Feb 2019 10:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34571 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Received: via spool by 34571-submit@debbugs.gnu.org id=B34571.155057263429350 (code B ref 34571); Tue, 19 Feb 2019 10:38:02 +0000 Received: (at 34571) by debbugs.gnu.org; 19 Feb 2019 10:37:14 +0000 Received: from localhost ([127.0.0.1]:53935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gw2m1-0007dK-P5 for submit@debbugs.gnu.org; Tue, 19 Feb 2019 05:37:14 -0500 Received: from flashner.co.il ([178.62.234.194]:33302) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gw2m0-0007d7-3z for 34571@debbugs.gnu.org; Tue, 19 Feb 2019 05:37:12 -0500 Received: from localhost (unknown [188.120.128.87]) by flashner.co.il (Postfix) with ESMTPSA id 8ABF540061; Tue, 19 Feb 2019 10:37:05 +0000 (UTC) Date: Tue, 19 Feb 2019 12:37:04 +0200 From: Efraim Flashner Message-ID: <20190219103704.GC32103@macbook41> References: <20190219092216.GA32103@macbook41> <20190219104640.631a3ba8@scratchpost.org> <20190219101059.GB32103@macbook41> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190219101059.GB32103@macbook41> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 User-Agent: Mutt/1.11.2 (2019-01-07) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 34571@debbugs.gnu.org Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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 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 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)))