diff --git a/pkgs/development/tools/yq/default.nix b/pkgs/development/python-modules/yq/default.nix similarity index 66% rename from pkgs/development/tools/yq/default.nix rename to pkgs/development/python-modules/yq/default.nix index cfca8a32f93f..3640023b10f4 100644 --- a/pkgs/development/tools/yq/default.nix +++ b/pkgs/development/python-modules/yq/default.nix @@ -1,6 +1,7 @@ { lib -, buildPythonApplication +, buildPythonPackage , fetchPypi +, pkgs , argcomplete , pyyaml , xmltodict @@ -12,11 +13,24 @@ , toml }: -buildPythonApplication rec { +buildPythonPackage rec { pname = "yq"; version = "2.10.1"; - propagatedBuildInputs = [ pyyaml xmltodict jq argcomplete ]; + src = fetchPypi { + inherit pname version; + sha256 = "1h6nnkp53mm4spwy8nyxwvh9j6p4lxvf20j4bgjskhnhaw3jl9gn"; + }; + + postPatch = '' + substituteInPlace test/test.py --replace "expect_exit_codes={0} if sys.stdin.isatty() else {2}" "expect_exit_codes={0}" + ''; + + propagatedBuildInputs = [ + pyyaml + xmltodict + argcomplete + ]; doCheck = true; @@ -24,16 +38,13 @@ buildPythonApplication rec { pytest coverage flake8 - jq + pkgs.jq toml ]; checkPhase = "pytest ./test/test.py"; - src = fetchPypi { - inherit pname version; - sha256 = "1h6nnkp53mm4spwy8nyxwvh9j6p4lxvf20j4bgjskhnhaw3jl9gn"; - }; + pythonImportsCheck = [ "yq" ]; meta = with lib; { description = "Command-line YAML processor - jq wrapper for YAML documents."; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f636f0fd894e..5f7b750c9a1e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11798,10 +11798,7 @@ in yodl = callPackage ../development/tools/misc/yodl { }; - yq = callPackage ../development/tools/yq { - inherit (python3Packages) - buildPythonApplication fetchPypi argcomplete pyyaml xmltodict pytest coverage flake8 toml; - }; + yq = python3.pkgs.toPythonApplication python3.pkgs.yq; yq-go = callPackage ../development/tools/yq-go { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index c2c471d97721..86e2faa238ec 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7614,6 +7614,8 @@ in { yowsup = callPackage ../development/python-modules/yowsup { }; + yq = callPackage ../development/python-modules/yq { }; + yt = callPackage ../development/python-modules/yt { }; yubico-client = callPackage ../development/python-modules/yubico-client { };