write{Jq,Python*}: use writeOut
This commit is contained in:
parent
bf81d1b6b9
commit
e78a8c0725
|
@ -252,17 +252,16 @@ with import <stockholm/lib>;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
writeJq = name: text: pkgs.runCommand name {
|
writeJq = name: text:
|
||||||
inherit text;
|
assert (with types; either absolute-pathname filename).check name;
|
||||||
passAsFile = [ "text" ];
|
pkgs.writeOut (baseNameOf name) {
|
||||||
} /* sh */ ''
|
${optionalString (types.absolute-pathname.check name) name} = {
|
||||||
name=${assert types.filename.check name; name}
|
check = pkgs.writeDash "jqcheck.sh" ''
|
||||||
|
exec ${pkgs.jq}/bin/jq -f "$1" -n
|
||||||
# syntax check
|
'';
|
||||||
${pkgs.jq}/bin/jq -f "$textPath" -n
|
inherit text;
|
||||||
|
};
|
||||||
cp "$textPath" "$out"
|
};
|
||||||
'';
|
|
||||||
|
|
||||||
writeJSON = name: value: pkgs.writeText name (toJSON value);
|
writeJSON = name: value: pkgs.writeText name (toJSON value);
|
||||||
|
|
||||||
|
@ -275,29 +274,27 @@ with import <stockholm/lib>;
|
||||||
${pkgs.cabal2nix}/bin/cabal2nix ${path} > $out
|
${pkgs.cabal2nix}/bin/cabal2nix ${path} > $out
|
||||||
'');
|
'');
|
||||||
|
|
||||||
writePython2 = name: text: pkgs.runCommand name {
|
writePython2 = name: text:
|
||||||
inherit text;
|
assert (with types; either absolute-pathname filename).check name;
|
||||||
passAsFile = [ "text" ];
|
pkgs.writeOut (baseNameOf name) {
|
||||||
} /* sh */ ''
|
${optionalString (types.absolute-pathname.check name) name} = {
|
||||||
name=${assert types.filename.check name; name}
|
check = pkgs.writeDash "python2check.sh" ''
|
||||||
|
exec ${pkgs.python2}/bin/python -m py_compile "$1"
|
||||||
|
'';
|
||||||
|
inherit text;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# syntax check
|
writePython3 = name: text:
|
||||||
${pkgs.python2}/bin/python -m py_compile "$textPath"
|
assert (with types; either absolute-pathname filename).check name;
|
||||||
|
pkgs.writeOut (baseNameOf name) {
|
||||||
cp "$textPath" "$out"
|
${optionalString (types.absolute-pathname.check name) name} = {
|
||||||
'';
|
check = pkgs.writeDash "python3check.sh" ''
|
||||||
|
exec ${pkgs.python3}/bin/python -m py_compile "$textPath"
|
||||||
writePython3 = name: text: pkgs.runCommand name {
|
'';
|
||||||
inherit text;
|
inherit text;
|
||||||
passAsFile = [ "text" ];
|
};
|
||||||
} /* sh */ ''
|
};
|
||||||
name=${assert types.filename.check name; name}
|
|
||||||
|
|
||||||
# syntax check
|
|
||||||
${pkgs.python3}/bin/python -m py_compile "$textPath"
|
|
||||||
|
|
||||||
cp "$textPath" "$out"
|
|
||||||
'';
|
|
||||||
|
|
||||||
writeSed = pkgs.makeScriptWriter "${pkgs.gnused}/bin/sed -f";
|
writeSed = pkgs.makeScriptWriter "${pkgs.gnused}/bin/sed -f";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue