commit
b5bf9da14d
|
@ -2,6 +2,7 @@
|
||||||
, nixosTests
|
, nixosTests
|
||||||
, buildPythonPackage
|
, buildPythonPackage
|
||||||
, fetchPypi
|
, fetchPypi
|
||||||
|
, substituteAll
|
||||||
, pkgs
|
, pkgs
|
||||||
, argcomplete
|
, argcomplete
|
||||||
, pyyaml
|
, pyyaml
|
||||||
|
@ -23,6 +24,13 @@ buildPythonPackage rec {
|
||||||
sha256 = "1q4rky0a6n4izmq7slb91a54g8swry1xrbfqxwc8lkd3hhvlxxkl";
|
sha256 = "1q4rky0a6n4izmq7slb91a54g8swry1xrbfqxwc8lkd3hhvlxxkl";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
(substituteAll {
|
||||||
|
src = ./jq-path.patch;
|
||||||
|
jq = "${lib.getBin pkgs.jq}/bin/jq";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace test/test.py --replace "expect_exit_codes={0} if sys.stdin.isatty() else {2}" "expect_exit_codes={0}"
|
substituteInPlace test/test.py --replace "expect_exit_codes={0} if sys.stdin.isatty() else {2}" "expect_exit_codes={0}"
|
||||||
'';
|
'';
|
||||||
|
@ -39,7 +47,6 @@ buildPythonPackage rec {
|
||||||
pytest
|
pytest
|
||||||
coverage
|
coverage
|
||||||
flake8
|
flake8
|
||||||
pkgs.jq
|
|
||||||
toml
|
toml
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
diff --git a/test/test.py b/test/test.py
|
||||||
|
index a81f41b..9e80f04 100755
|
||||||
|
--- a/test/test.py
|
||||||
|
+++ b/test/test.py
|
||||||
|
@@ -112,7 +112,7 @@ class TestYq(unittest.TestCase):
|
||||||
|
tf2.seek(0)
|
||||||
|
self.assertEqual(self.run_yq("", ["-y", arg, tf.name, self.fd_path(tf2)]), '1\n...\n')
|
||||||
|
|
||||||
|
- @unittest.skipIf(subprocess.check_output(["jq", "--version"]) < b"jq-1.6", "Test options introduced in jq 1.6")
|
||||||
|
+ @unittest.skipIf(subprocess.check_output(["@jq@", "--version"]) < b"jq-1.6", "Test options introduced in jq 1.6")
|
||||||
|
def test_jq16_arg_passthrough(self):
|
||||||
|
self.assertEqual(self.run_yq("{}", ["--indentless", "-y", ".a=$ARGS.positional", "--args", "a", "b"]),
|
||||||
|
"a:\n- a\n- b\n")
|
||||||
|
diff --git a/yq/__init__.py b/yq/__init__.py
|
||||||
|
index afeb42c..a0d7970 100755
|
||||||
|
--- a/yq/__init__.py
|
||||||
|
+++ b/yq/__init__.py
|
||||||
|
@@ -146,7 +146,7 @@ def yq(input_streams=None, output_stream=None, input_format="yaml", output_forma
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Note: universal_newlines is just a way to induce subprocess to make stdin a text buffer and encode it for us
|
||||||
|
- jq = subprocess.Popen(["jq"] + list(jq_args),
|
||||||
|
+ jq = subprocess.Popen(["@jq@"] + list(jq_args),
|
||||||
|
stdin=subprocess.PIPE,
|
||||||
|
stdout=subprocess.PIPE if converting_output else None,
|
||||||
|
universal_newlines=True)
|
Loading…
Reference in New Issue