about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/yq/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/yq/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/yq/default.nix27
1 files changed, 19 insertions, 8 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/yq/default.nix b/nixpkgs/pkgs/development/python-modules/yq/default.nix
index f795a8fdfad6..83f9c7a9980b 100644
--- a/nixpkgs/pkgs/development/python-modules/yq/default.nix
+++ b/nixpkgs/pkgs/development/python-modules/yq/default.nix
@@ -1,6 +1,8 @@
 { lib
+, nixosTests
 , buildPythonPackage
 , fetchPypi
+, substituteAll
 , pkgs
 , argcomplete
 , pyyaml
@@ -10,19 +12,29 @@
 , flake8
 , jq
 , pytest
-, unixtools
 , toml
 }:
 
 buildPythonPackage rec {
   pname = "yq";
-  version = "2.11.0";
+  version = "2.11.1";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1gp9q5w1bjbw7wmba5hm8ippwvkind0p02n07fqa9jlqglhxhm46";
+    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
@@ -32,21 +44,20 @@ buildPythonPackage rec {
   doCheck = true;
 
   checkInputs = [
-   unixtools.script
    pytest
    coverage
    flake8
-   pkgs.jq
    toml
   ];
 
-  # tests fails if stdin is not a tty
-  checkPhase = "echo | script -c 'pytest ./test/test.py'";
+  checkPhase = "pytest ./test/test.py";
 
   pythonImportsCheck = [ "yq" ];
 
+  passthru.tests = { inherit (nixosTests) yq; };
+
   meta = with lib; {
-    description = "Command-line YAML processor - jq wrapper for YAML documents.";
+    description = "Command-line YAML processor - jq wrapper for YAML documents";
     homepage = "https://github.com/kislyuk/yq";
     license = [ licenses.asl20 ];
     maintainers = [ maintainers.womfoo ];