nixpkgs/pkgs/development/python-modules/yq/default.nix

66 lines
1.1 KiB
Nix
Raw Normal View History

{ lib
2020-12-18 18:07:30 +01:00
, nixosTests
, buildPythonPackage
, fetchPypi
, substituteAll
, pkgs
, argcomplete
, pyyaml
, xmltodict
# Test inputs
, coverage
, flake8
, jq
, pytest
, toml
}:
2017-11-13 19:32:13 +01: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
src = fetchPypi {
inherit pname version;
2020-10-01 15:21:21 +02:00
sha256 = "1q4rky0a6n4izmq7slb91a54g8swry1xrbfqxwc8lkd3hhvlxxkl";
};
patches = [
(substituteAll {
src = ./jq-path.patch;
jq = "${lib.getBin pkgs.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 19:32:13 +01:00
doCheck = true;
checkInputs = [
pytest
coverage
flake8
toml
];
checkPhase = "pytest ./test/test.py";
2017-11-13 19:32:13 +01: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; {
description = "Command-line YAML processor - jq wrapper for YAML documents";
homepage = "https://github.com/kislyuk/yq";
2017-11-13 19:32:13 +01:00
license = [ licenses.asl20 ];
maintainers = [ maintainers.womfoo ];
};
}