about summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers/bazel/bazel_3/python-shebang.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/build-managers/bazel/bazel_3/python-shebang.patch')
-rw-r--r--pkgs/development/tools/build-managers/bazel/bazel_3/python-shebang.patch20
1 files changed, 20 insertions, 0 deletions
diff --git a/pkgs/development/tools/build-managers/bazel/bazel_3/python-shebang.patch b/pkgs/development/tools/build-managers/bazel/bazel_3/python-shebang.patch
new file mode 100644
index 000000000000..75547264fcc8
--- /dev/null
+++ b/pkgs/development/tools/build-managers/bazel/bazel_3/python-shebang.patch
@@ -0,0 +1,20 @@
+--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java	2020-05-25 14:46:01.608403087 +0200
++++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java	2020-05-25 14:50:52.881398320 +0200
+@@ -238,14 +238,15 @@
+         // TODO(#8685): Remove this special-case handling as part of making the proper shebang a
+         // property of the Python toolchain configuration.
+         String pythonExecutableName = OS.getCurrent() == OS.OPENBSD ? "python3" : "python";
++        String pythonShebang = "#!/usr/bin/env " + pythonExecutableName;
+         ruleContext.registerAction(
+             new SpawnAction.Builder()
+                 .addInput(zipFile)
+                 .addOutput(executable)
+                 .setShellCommand(
+                     shExecutable,
+-                    "echo '#!/usr/bin/env "
+-                        + pythonExecutableName
++                    "echo '"
++                        + pythonShebang
+                         + "' | cat - "
+                         + zipFile.getExecPathString()
+                         + " > "