1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-21 05:25:38 +00:00
nixpkgs/pkgs/development/tools/build-managers/bazel/bazel_3/python-shebang.patch
2020-05-29 08:52:17 +02:00

21 lines
1.1 KiB
Diff

--- 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()
+ " > "