micropython 1.7 (new formula)
Add formula for MicroPython, a very lightweight implementation of Python suitable for embedded systems. Does not include cross-compilation support. Related to issue #42448 Closes #353. Signed-off-by: Tim D. Smith <git@tim-smith.us>
This commit is contained in:
parent
508b8c7544
commit
3b71c1fb6f
1 changed files with 51 additions and 0 deletions
51
Formula/micropython.rb
Normal file
51
Formula/micropython.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
class Micropython < Formula
|
||||
desc "Python implementation for microcontrollers and constrained systems"
|
||||
homepage "https://www.micropython.org/"
|
||||
url "https://github.com/micropython/micropython/archive/v1.7.tar.gz"
|
||||
sha256 "ad44d28700d346ceb9a70ae92d36306d42e187fc1af19fa2c7a3ab7dc18742ef"
|
||||
|
||||
depends_on "pkg-config" => :build
|
||||
depends_on "libffi" # Requires libffi v3 closure API; OS X version is too old
|
||||
|
||||
# The install command in the Makefile uses GNU coreutils syntax
|
||||
# which is incompatible with BSD's install and needs patching
|
||||
# https://github.com/micropython/micropython/issues/1984
|
||||
patch :DATA
|
||||
|
||||
def install
|
||||
cd "unix" do
|
||||
system "make", "install", "PREFIX=#{prefix}", "V=1"
|
||||
end
|
||||
end
|
||||
|
||||
test do
|
||||
# Test the FFI module
|
||||
(testpath/"ffi-hello.py").write <<-EOS.undent
|
||||
import ffi
|
||||
|
||||
libc = ffi.open("libc.dylib")
|
||||
printf = libc.func("v", "printf", "s")
|
||||
printf("Hello!\\n")
|
||||
EOS
|
||||
|
||||
system "#{bin}/micropython", "ffi-hello.py"
|
||||
end
|
||||
end
|
||||
|
||||
__END__
|
||||
diff --git a/unix/Makefile b/unix/Makefile
|
||||
index 6d6239f..c556473 100644
|
||||
--- a/unix/Makefile
|
||||
+++ b/unix/Makefile
|
||||
@@ -186,8 +186,9 @@ PIPSRC = ../tools/pip-micropython
|
||||
PIPTARGET = pip-micropython
|
||||
|
||||
install: micropython
|
||||
- install -D $(TARGET) $(BINDIR)/$(TARGET)
|
||||
- install -D $(PIPSRC) $(BINDIR)/$(PIPTARGET)
|
||||
+ install -d $(BINDIR)
|
||||
+ install $(TARGET) $(BINDIR)/$(TARGET)
|
||||
+ install $(PIPSRC) $(BINDIR)/$(PIPTARGET)
|
||||
|
||||
# uninstall micropython
|
||||
uninstall:
|
Loading…
Reference in a new issue