depot/third_party/nixpkgs/pkgs/development/interpreters/micropython/default.nix
Default email 88abffb7d2 Project import generated by Copybara.
GitOrigin-RevId: bc9b956714ed6eac5f8888322aac5bc41389defa
2021-09-18 12:52:07 +02:00

63 lines
1.4 KiB
Nix

{ stdenv
, lib
, fetchFromGitHub
, pkg-config
, python3
, libffi
, readline
}:
stdenv.mkDerivation rec {
pname = "micropython";
version = "1.17";
src = fetchFromGitHub {
owner = "micropython";
repo = "micropython";
rev = "v${version}";
sha256 = "0aqij36iykmfdsv5dqrifvghmjx7qid8hmbxcpx3xpk3nizh7w84";
fetchSubmodules = true;
};
nativeBuildInputs = [ pkg-config python3 ];
buildInputs = [ libffi readline ];
buildPhase = ''
runHook preBuild
make -C mpy-cross
make -C ports/unix
runHook postBuild
'';
doCheck = true;
skippedTests = ""
+ lib.optionalString (stdenv.isDarwin) " -e uasyncio_basic -e uasyncio_wait_task"
+ lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) " -e ffi_callback"
+ lib.optionalString (stdenv.isLinux && stdenv.isAarch64) " -e float_parse"
;
checkPhase = ''
runHook preCheck
pushd tests
${python3.interpreter} ./run-tests.py ${skippedTests}
popd
runHook postCheck
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install -Dm755 ports/unix/micropython -t $out/bin
runHook postInstall
'';
meta = with lib; {
description = "A lean and efficient Python implementation for microcontrollers and constrained systems";
homepage = "https://micropython.org";
platforms = platforms.unix;
license = licenses.mit;
maintainers = with maintainers; [ prusnak sgo ];
};
}