New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yq: fix path to jq #103737
yq: fix path to jq #103737
Conversation
@@ -27,6 +27,7 @@ buildPythonPackage rec { | |||
pyyaml | |||
xmltodict | |||
argcomplete | |||
jq |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the package is "shelling" out to it, this should be patched in the source to do so. Otherwise there's no guarantee that it will work when imported as a python module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing that out! I patched the package; could you please take another look?
patches = [ ./jq-path.patch ]; | ||
|
||
postPatch = '' | ||
substituteInPlace test/test.py --replace "expect_exit_codes={0} if sys.stdin.isatty() else {2}" "expect_exit_codes={0}" | ||
substituteInPlace yq/__init__.py --subst-var-by JQ "${lib.getBin pkgs.jq}/bin/jq" | ||
substituteInPlace test/test.py \ | ||
--subst-var-by JQ "${lib.getBin pkgs.jq}/bin/jq" \ | ||
--replace "expect_exit_codes={0} if sys.stdin.isatty() else {2}" "expect_exit_codes={0}" | ||
''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can actually replace the variables you have with substitute within the patches
declaration so you don't really need the postPatch for the JQ substitution.
Example:
nixpkgs/pkgs/applications/audio/curseradio/default.nix
Lines 20 to 25 in 14f2dc1
patches = [ | |
(substituteAll { | |
src = ./mpv.patch; | |
inherit mpv; | |
}) | |
]; |
f0826c4
to
d26a776
Compare
yq requires jq at runtime, so that the package is broken unless the path to jq is patched in.
yq requires jq at runtime, so that the package is broken without patching in the path to jq.
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)