2020-08-15 00:27:07 -07:00
|
|
|
{ lib
|
2020-12-18 09:07:30 -08:00
|
|
|
, nixosTests
|
2020-09-19 07:26:21 -07:00
|
|
|
, buildPythonPackage
|
2020-08-15 00:27:07 -07:00
|
|
|
, fetchPypi
|
2020-11-13 12:09:57 -08:00
|
|
|
, substituteAll
|
2020-08-15 00:27:07 -07:00
|
|
|
, argcomplete
|
|
|
|
, pyyaml
|
|
|
|
, xmltodict
|
|
|
|
, jq
|
2021-02-11 17:52:07 -08:00
|
|
|
, pytestCheckHook
|
2020-08-15 00:27:07 -07:00
|
|
|
}:
|
2017-11-13 10:32:13 -08:00
|
|
|
|
2020-09-19 07:26:21 -07:00
|
|
|
buildPythonPackage rec {
|
2017-11-13 10:32:13 -08:00
|
|
|
pname = "yq";
|
2021-02-09 05:55:41 -08:00
|
|
|
version = "2.12.0";
|
2017-11-13 10:32:13 -08:00
|
|
|
|
2020-09-19 07:26:21 -07:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-02-09 05:55:41 -08:00
|
|
|
sha256 = "sha256-HSrUA1BNMGtSWLhsaY+YVtetWLe7F6K4dWkaanuMTCA=";
|
2020-09-19 07:26:21 -07:00
|
|
|
};
|
|
|
|
|
2020-11-13 12:09:57 -08:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./jq-path.patch;
|
2021-02-11 17:52:07 -08:00
|
|
|
jq = "${lib.getBin jq}/bin/jq";
|
2020-11-13 12:09:57 -08:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-10-16 04:47:11 -07:00
|
|
|
postPatch = ''
|
2021-02-11 17:52:07 -08:00
|
|
|
substituteInPlace test/test.py \
|
|
|
|
--replace "expect_exit_codes={0} if sys.stdin.isatty() else {2}" "expect_exit_codes={0}"
|
2020-10-16 04:47:11 -07:00
|
|
|
'';
|
|
|
|
|
2020-09-19 07:26:21 -07:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
pyyaml
|
|
|
|
xmltodict
|
|
|
|
argcomplete
|
|
|
|
];
|
2017-11-13 10:32:13 -08:00
|
|
|
|
2020-08-15 00:27:07 -07:00
|
|
|
checkInputs = [
|
2021-02-11 17:52:07 -08:00
|
|
|
pytestCheckHook
|
2020-08-15 00:27:07 -07:00
|
|
|
];
|
|
|
|
|
2021-02-11 17:52:07 -08:00
|
|
|
pytestFlagsArray = [ "test/test.py" ];
|
2017-11-13 10:32:13 -08:00
|
|
|
|
2020-09-19 07:26:21 -07:00
|
|
|
pythonImportsCheck = [ "yq" ];
|
2017-11-13 10:32:13 -08:00
|
|
|
|
2020-12-18 09:07:30 -08:00
|
|
|
passthru.tests = { inherit (nixosTests) yq; };
|
|
|
|
|
2017-11-13 10:32:13 -08:00
|
|
|
meta = with lib; {
|
2020-10-10 22:55:05 -07:00
|
|
|
description = "Command-line YAML processor - jq wrapper for YAML documents";
|
2020-03-31 18:11:51 -07:00
|
|
|
homepage = "https://github.com/kislyuk/yq";
|
2021-02-11 17:52:07 -08:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ womfoo SuperSandro2000 ];
|
2017-11-13 10:32:13 -08:00
|
|
|
};
|
|
|
|
}
|