2020-08-20 17:08:02 +00:00
|
|
|
{ lib
|
2020-12-25 13:55:36 +00:00
|
|
|
, nixosTests
|
2020-09-25 04:45:31 +00:00
|
|
|
, buildPythonPackage
|
2020-08-20 17:08:02 +00:00
|
|
|
, fetchPypi
|
2020-12-27 14:24:52 +00:00
|
|
|
, substituteAll
|
2020-09-25 04:45:31 +00:00
|
|
|
, pkgs
|
2020-08-20 17:08:02 +00:00
|
|
|
, argcomplete
|
|
|
|
, pyyaml
|
|
|
|
, xmltodict
|
|
|
|
# Test inputs
|
|
|
|
, coverage
|
|
|
|
, flake8
|
|
|
|
, jq
|
|
|
|
, pytest
|
|
|
|
, toml
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
buildPythonPackage rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "yq";
|
2020-10-07 09:15:18 +00:00
|
|
|
version = "2.11.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2020-10-07 09:15:18 +00:00
|
|
|
sha256 = "1q4rky0a6n4izmq7slb91a54g8swry1xrbfqxwc8lkd3hhvlxxkl";
|
2020-09-25 04:45:31 +00:00
|
|
|
};
|
|
|
|
|
2020-12-27 14:24:52 +00:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./jq-path.patch;
|
|
|
|
jq = "${lib.getBin pkgs.jq}/bin/jq";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-11-15 13:44:38 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace test/test.py --replace "expect_exit_codes={0} if sys.stdin.isatty() else {2}" "expect_exit_codes={0}"
|
|
|
|
'';
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
pyyaml
|
|
|
|
xmltodict
|
|
|
|
argcomplete
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
pytest
|
|
|
|
coverage
|
|
|
|
flake8
|
|
|
|
toml
|
|
|
|
];
|
|
|
|
|
2020-11-15 13:44:38 +00:00
|
|
|
checkPhase = "pytest ./test/test.py";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
pythonImportsCheck = [ "yq" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
passthru.tests = { inherit (nixosTests) yq; };
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2020-10-19 00:13:06 +00:00
|
|
|
description = "Command-line YAML processor - jq wrapper for YAML documents";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/kislyuk/yq";
|
|
|
|
license = [ licenses.asl20 ];
|
|
|
|
maintainers = [ maintainers.womfoo ];
|
|
|
|
};
|
|
|
|
}
|