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