about summary refs log tree commit diff
path: root/pkgs/development/python-modules/yq
diff options
context:
space:
mode:
authorMartin Weinelt <hexa@darmstadt.ccc.de>2020-09-19 16:26:21 +0200
committerMartin Weinelt <hexa@darmstadt.ccc.de>2020-09-21 20:09:28 +0200
commite2283652588f41d66540cd963e8445ef8ff79be2 (patch)
tree4c3b63fb03d2c3e1ecc176f9e3f5c77a521c1074 /pkgs/development/python-modules/yq
parenteb86bff30d874d7d65a7f7342dc81b70815a25df (diff)
pythonPackages.yq: repackage as library, convert to application, fix tests
Diffstat (limited to 'pkgs/development/python-modules/yq')
-rw-r--r--pkgs/development/python-modules/yq/default.nix55
1 files changed, 55 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/yq/default.nix b/pkgs/development/python-modules/yq/default.nix
new file mode 100644
index 0000000000000..3640023b10f46
--- /dev/null
+++ b/pkgs/development/python-modules/yq/default.nix
@@ -0,0 +1,55 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, pkgs
+, argcomplete
+, pyyaml
+, xmltodict
+# Test inputs
+, coverage
+, flake8
+, jq
+, pytest
+, toml
+}:
+
+buildPythonPackage rec {
+  pname = "yq";
+  version = "2.10.1";
+
+  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;
+
+  checkInputs = [
+   pytest
+   coverage
+   flake8
+   pkgs.jq
+   toml
+  ];
+
+  checkPhase = "pytest ./test/test.py";
+
+  pythonImportsCheck = [ "yq" ];
+
+  meta = with lib; {
+    description = "Command-line YAML processor - jq wrapper for YAML documents.";
+    homepage = "https://github.com/kislyuk/yq";
+    license = [ licenses.asl20 ];
+    maintainers = [ maintainers.womfoo ];
+  };
+}