summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2016-08-04 23:56:39 +0200
committerlassulus <lass@aidsballs.de>2016-08-04 23:56:39 +0200
commit2d0824fb99e5b58cad8c47068be449bfecf9b5ae (patch)
tree8bd755a9dbcfab8122cbb973f2dc3cf750a7cf03 /krebs/5pkgs
parentad00352682ee3d1e564cd4edf4ea60c45cf2ccb7 (diff)
k 5 builders: add writePython{2,3}
Diffstat (limited to 'krebs/5pkgs')
-rw-r--r--krebs/5pkgs/builders.nix22
1 files changed, 22 insertions, 0 deletions
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";
}