pythonPackages.yq: repackage as library, convert to application, fix tests

This commit is contained in:
Martin Weinelt 2020-09-19 16:26:21 +02:00
parent eb86bff30d
commit e228365258
No known key found for this signature in database
GPG key ID: BD4AA0528F63F17E
3 changed files with 22 additions and 12 deletions

View file

@ -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.";

View file

@ -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 { };

View file

@ -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 { };