3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/python-modules/yq/default.nix

59 lines
1.1 KiB
Nix
Raw Normal View History

{ lib
, buildPythonPackage
, fetchPypi
, substituteAll
, argcomplete
, pyyaml
, xmltodict
, jq
, pytestCheckHook
}:
2017-11-13 18:32:13 +00:00
buildPythonPackage rec {
2017-11-13 18:32:13 +00:00
pname = "yq";
2021-12-06 03:00:17 +00:00
version = "2.13.0";
2017-11-13 18:32:13 +00:00
src = fetchPypi {
inherit pname version;
2021-12-06 03:00:17 +00:00
sha256 = "sha256-/RMf2x9WcWrY1EzZ6q99OyLTm6iGHqZKQJzD9K4mPbg=";
};
patches = [
(substituteAll {
src = ./jq-path.patch;
jq = "${lib.getBin jq}/bin/jq";
})
];
postPatch = ''
substituteInPlace test/test.py \
--replace "expect_exit_codes={0} if sys.stdin.isatty() else {2}" "expect_exit_codes={0}"
'';
propagatedBuildInputs = [
pyyaml
xmltodict
argcomplete
];
2017-11-13 18:32:13 +00:00
checkInputs = [
pytestCheckHook
];
pytestFlagsArray = [ "test/test.py" ];
2017-11-13 18:32:13 +00:00
pythonImportsCheck = [ "yq" ];
2017-11-13 18:32:13 +00:00
doInstallCheck = true;
installCheckPhase = ''
echo '{"hello":{"foo":"bar"}}' | $out/bin/yq -y . | grep 'foo: bar'
'';
2020-12-18 17:07:30 +00:00
2017-11-13 18:32:13 +00:00
meta = with lib; {
description = "Command-line YAML processor - jq wrapper for YAML documents";
homepage = "https://github.com/kislyuk/yq";
license = licenses.asl20;
maintainers = with maintainers; [ womfoo SuperSandro2000 ];
2017-11-13 18:32:13 +00:00
};
}