2021-02-05 17:12:51 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, pkg-config, libffi, python3, readline }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "micropython";
|
2020-10-07 09:15:18 +00:00
|
|
|
version = "1.13";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "micropython";
|
|
|
|
repo = "micropython";
|
|
|
|
rev = "v${version}";
|
2020-10-07 09:15:18 +00:00
|
|
|
sha256 = "0m9g6isys4pnlnkdmrw7lxaxdrjn02j481wz5x5cdrmrbi4zi17z";
|
2020-04-24 23:36:52 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config python3 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildInputs = [ libffi readline ];
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
make -C mpy-cross
|
|
|
|
make -C ports/unix
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
pushd tests
|
|
|
|
MICROPY_MICROPYTHON=../ports/unix/micropython ${python3.interpreter} ./run-tests
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
install -Dm755 ports/unix/micropython $out/bin/micropython
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A lean and efficient Python implementation for microcontrollers and constrained systems";
|
|
|
|
homepage = "https://micropython.org";
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ sgo ];
|
|
|
|
};
|
|
|
|
}
|