writers: add deps & flake8 to writePython{2,3}

This commit is contained in:
lassulus 2018-01-02 12:59:01 +01:00
parent bfde8bea27
commit c25054b4a0

View File

@ -283,27 +283,27 @@ with import <stockholm/lib>;
${pkgs.cabal2nix}/bin/cabal2nix ${path} > $out ${pkgs.cabal2nix}/bin/cabal2nix ${path} > $out
''); '');
writePython2 = name: text: writePython2 = deps:
assert (with types; either absolute-pathname filename).check name; let
pkgs.writeOut (baseNameOf name) { py = pkgs.python2.withPackages(ps: attrVals deps ps);
${optionalString (types.absolute-pathname.check name) name} = { in
check = pkgs.writeDash "python2check.sh" '' pkgs.makeScriptWriter {
exec ${pkgs.python2}/bin/python -m py_compile "$1" interpreter = "${py}/bin/python";
''; check = pkgs.writeDash "python2check.sh" ''
inherit text; exec ${pkgs.python2Packages.flake8}/bin/flake8 --show-source "$1"
}; '';
}; };
writePython3 = name: text: writePython3 = deps:
assert (with types; either absolute-pathname filename).check name; let
pkgs.writeOut (baseNameOf name) { py = pkgs.python3.withPackages(ps: attrVals deps ps);
${optionalString (types.absolute-pathname.check name) name} = { in
check = pkgs.writeDash "python3check.sh" '' pkgs.makeScriptWriter {
exec ${pkgs.python3}/bin/python -m py_compile "$textPath" interpreter = "${py}/bin/python";
''; check = pkgs.writeDash "python3check.sh" ''
inherit text; exec ${pkgs.python3Packages.flake8}/bin/flake8 --show-source "$1"
}; '';
}; };
writeSed = pkgs.makeScriptWriter { writeSed = pkgs.makeScriptWriter {
interpreter = "${pkgs.gnused}/bin/sed -f"; interpreter = "${pkgs.gnused}/bin/sed -f";