From f426173e30d2f7dcc151b3d67a29ee6e8ca39c1a Mon Sep 17 00:00:00 2001 From: Andreas Herrmann Date: Fri, 16 Aug 2019 14:10:27 +0200 Subject: [PATCH] bazel: Fix python stub template The shebang in the python stub template was incorrectly patched to ``` /bin/env python ``` instead of ``` /bin/python ``` The reason was that `patchShebangs` was called with `--replace` which is an unknown argument. ``` patching script interpreter paths in src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt --replace /usr/bin/env python /nix/store/w7gsq8v86hni4ynaqgwwlnlny115ylng-python3-3.7.4/bin/python find: unknown predicate `--replace' ``` Using `substituteInPlace` instead resolves that issue. The wrong shebang caused failures of `py_binary` targets due to `python` not being in `PATH` in certain circumstances. --- pkgs/development/tools/build-managers/bazel/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/tools/build-managers/bazel/default.nix b/pkgs/development/tools/build-managers/bazel/default.nix index f67d8e761b4..1007f4df8ca 100644 --- a/pkgs/development/tools/build-managers/bazel/default.nix +++ b/pkgs/development/tools/build-managers/bazel/default.nix @@ -323,7 +323,7 @@ stdenv.mkDerivation rec { genericPatches = '' # Substitute python's stub shebang to plain python path. (see TODO add pr URL) # See also `postFixup` where python is added to $out/nix-support - patchShebangs src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt \ + substituteInPlace src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt \ --replace "#!/usr/bin/env python" "#!${python3}/bin/python" # md5sum is part of coreutils