From 2d0824fb99e5b58cad8c47068be449bfecf9b5ae Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 4 Aug 2016 23:56:39 +0200 Subject: k 5 builders: add writePython{2,3} --- krebs/5pkgs/builders.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/krebs/5pkgs/builders.nix b/krebs/5pkgs/builders.nix index 4c087bc44..841543819 100644 --- a/krebs/5pkgs/builders.nix +++ b/krebs/5pkgs/builders.nix @@ -253,5 +253,27 @@ rec { ${pkgs.cabal2nix}/bin/cabal2nix ${path} > $out ''); + writePython2 = name: src: pkgs.runCommand name {} /* sh */ '' + name=${assert types.filename.check name; name} + src=${shell.escape src} + + # syntax check + printf '%s' "$src" > src.py + ${pkgs.python2}/bin/python -m py_compile src.py + + cp src.py "$out" + ''; + + writePython3 = name: src: pkgs.runCommand name {} /* sh */ '' + name=${assert types.filename.check name; name} + src=${shell.escape src} + + # syntax check + printf '%s' "$src" > src.py + ${pkgs.python3}/bin/python -m py_compile src.py + + cp src.py "$out" + ''; + writeSed = makeScriptWriter "${pkgs.gnused}/bin/sed -f"; } -- cgit v1.2.3