Gentoo Archives: gentoo-commits

From: Patrice Clement <monsieurp@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/micropython/, dev-lang/micropython/files/
Date: Sat, 25 Nov 2017 11:51:14
Message-Id: 1511610665.c3fe6df715e7869f381212fec2899587def57f07.monsieurp@gentoo
1 commit: c3fe6df715e7869f381212fec2899587def57f07
2 Author: Patrice Clement <monsieurp <AT> gentoo <DOT> org>
3 AuthorDate: Sat Nov 25 11:48:39 2017 +0000
4 Commit: Patrice Clement <monsieurp <AT> gentoo <DOT> org>
5 CommitDate: Sat Nov 25 11:51:05 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c3fe6df7
7
8 dev-lang/micropython: new package.
9
10 The MicroPython project aims to put an implementation of Python 3.x on
11 microcontrollers and small embedded systems.
12
13 Package-Manager: Portage-2.3.13, Repoman-2.3.3
14
15 dev-lang/micropython/Manifest | 1 +
16 .../micropython-1.9.3-prevent-stripping.patch | 22 +++++++++
17 dev-lang/micropython/metadata.xml | 30 ++++++++++++
18 dev-lang/micropython/micropython-1.9.3.ebuild | 54 ++++++++++++++++++++++
19 4 files changed, 107 insertions(+)
20
21 diff --git a/dev-lang/micropython/Manifest b/dev-lang/micropython/Manifest
22 new file mode 100644
23 index 00000000000..5b5ef6cd2f5
24 --- /dev/null
25 +++ b/dev-lang/micropython/Manifest
26 @@ -0,0 +1 @@
27 +DIST micropython-1.9.3.tar.gz 17311734 BLAKE2B 31ebdedc402af53b205a854aa61b59c694cc893c7f80e4b84196c5d44527545f442628938b7dd923ed9086a79e00ff899682548115224613e888eb8a37dd5ae3 SHA512 1b4358913ed78df66314c9a62636c7b8d086c731459e3bee1fab8695286dc03b6ec7594b2f9b8105e2a6d62190d95c6ad5351fb64c666c1ea54b9535193ee8a8
28
29 diff --git a/dev-lang/micropython/files/micropython-1.9.3-prevent-stripping.patch b/dev-lang/micropython/files/micropython-1.9.3-prevent-stripping.patch
30 new file mode 100644
31 index 00000000000..5ae7299f9f9
32 --- /dev/null
33 +++ b/dev-lang/micropython/files/micropython-1.9.3-prevent-stripping.patch
34 @@ -0,0 +1,22 @@
35 +--- a/py/mkenv.mk 2017-11-25 09:52:30.921836372 +0000
36 ++++ a/py/mkenv.mk 2017-11-25 09:52:35.257861233 +0000
37 +@@ -50,7 +50,6 @@
38 + LD = $(CROSS_COMPILE)ld
39 + OBJCOPY = $(CROSS_COMPILE)objcopy
40 + SIZE = $(CROSS_COMPILE)size
41 +-STRIP = $(CROSS_COMPILE)strip
42 + AR = $(CROSS_COMPILE)ar
43 + ifeq ($(MICROPY_FORCE_32BIT),1)
44 + CC += -m32
45 +--- a/py/mkrules.mk 2017-11-25 09:53:13.107078063 +0000
46 ++++ a/py/mkrules.mk 2017-11-25 09:53:31.898185592 +0000
47 +@@ -132,9 +132,6 @@
48 + # Do not pass COPT here - it's *C* compiler optimizations. For example,
49 + # we may want to compile using Thumb, but link with non-Thumb libc.
50 + $(Q)$(CC) -o $@ $^ $(LIB) $(LDFLAGS)
51 +-ifndef DEBUG
52 +- $(Q)$(STRIP) $(STRIPFLAGS_EXTRA) $(PROG)
53 +-endif
54 + $(Q)$(SIZE) $$(find $(BUILD) -path "$(BUILD)/build/frozen*.o") $(PROG)
55 +
56 + clean: clean-prog
57
58 diff --git a/dev-lang/micropython/metadata.xml b/dev-lang/micropython/metadata.xml
59 new file mode 100644
60 index 00000000000..e644fcc0141
61 --- /dev/null
62 +++ b/dev-lang/micropython/metadata.xml
63 @@ -0,0 +1,30 @@
64 +<?xml version="1.0" encoding="UTF-8"?>
65 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
66 +<pkgmetadata>
67 + <maintainer type="person">
68 + <email>monsieurp@g.o</email>
69 + <name>Patrice Clement</name>
70 + </maintainer>
71 + <maintainer type="project">
72 + <email>python@g.o</email>
73 + <name>Python</name>
74 + </maintainer>
75 + <upstream>
76 + <remote-id type="github">micropython/micropython</remote-id>
77 + </upstream>
78 + <longdescription lang="en">
79 +The MicroPython project aims to put an implementation of Python 3.x on
80 +microcontrollers and small embedded systems.
81 +MicroPython implements the entire Python 3.4 syntax (including exceptions,
82 +with, yield from, etc., and additionally async/await keywords from Python 3.5).
83 +The following core datatypes are provided: str (including basic Unicode
84 +support), bytes, bytearray, tuple, list, dict, set, frozenset, array.array,
85 +collections.namedtuple, classes and instances. Builtin modules include sys,
86 +time, and struct, etc. Select ports have support for _thread module
87 +(multithreading). Note that only a subset of Python 3 functionality is
88 +implemented for the data types and modules.
89 +MicroPython can execute scripts in textual source form or from precompiled
90 +bytecode, in both cases either from an on-device filesystem or "frozen" into
91 +the MicroPython executable.
92 + </longdescription>
93 +</pkgmetadata>
94
95 diff --git a/dev-lang/micropython/micropython-1.9.3.ebuild b/dev-lang/micropython/micropython-1.9.3.ebuild
96 new file mode 100644
97 index 00000000000..672087758df
98 --- /dev/null
99 +++ b/dev-lang/micropython/micropython-1.9.3.ebuild
100 @@ -0,0 +1,54 @@
101 +# Copyright 1999-2017 Gentoo Foundation
102 +# Distributed under the terms of the GNU General Public License v2
103 +
104 +EAPI=6
105 +
106 +inherit toolchain-funcs
107 +
108 +DESCRIPTION="Python implementation for microcontrollers"
109 +HOMEPAGE="https://github.com/micropython/micropython"
110 +SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${PV}/${P}.tar.gz"
111 +
112 +KEYWORDS="~amd64 ~x86"
113 +LICENSE="MIT"
114 +SLOT="0"
115 +IUSE="test"
116 +
117 +DEPEND="
118 + virtual/libffi
119 + virtual/pkgconfig"
120 +
121 +PATCHES=( "${FILESDIR}/${P}-prevent-stripping.patch" )
122 +
123 +src_compile() {
124 + cd ports/unix || die
125 +
126 + # 1) don't die on compiler warnings
127 + # 2) remove /usr/local prefix references in favour of /usr
128 + sed -i \
129 + -e 's#-Werror##g;' \
130 + -e 's#\/usr\/local#\/usr#g;' \
131 + Makefile || die
132 + emake CC="$(tc-getCC)" axtls
133 + emake CC="$(tc-getCC)"
134 +}
135 +
136 +src_test() {
137 + # XXX: find out why these tests fail
138 + rm -v tests/misc/recursive_iternext* || die
139 +
140 + cd ports/unix || die
141 + emake test
142 +}
143 +
144 +src_install() {
145 + pushd ports/unix > /dev/null || die
146 + emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" DESTDIR="${D}" install
147 + popd > /dev/null || die
148 +
149 + # remove .git files
150 + find tools -type f -name '.git*' -exec rm {} \; || die
151 +
152 + dodoc -r tools
153 + einstalldocs
154 +}