Lines 1-21
Link Here
|
1 |
--- src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java.orig 2020-03-03 17:09:23 UTC |
1 |
--- src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java.orig 2020-07-03 15:30:52.313535000 +0200 |
2 |
+++ src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java |
2 |
+++ src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java 2020-07-03 15:31:54.048865000 +0200 |
3 |
@@ -237,15 +237,15 @@ public class BazelPythonSemantics implem |
3 |
@@ -247,9 +247,9 @@ |
4 |
PathFragment shExecutable = ShToolchain.getPathOrError(ruleContext); |
4 |
PathFragment shExecutable = ShToolchain.getPathOrError(ruleContext); |
5 |
// TODO(#8685): Remove this special-case handling as part of making the proper shebang a |
5 |
// TODO(#8685): Remove this special-case handling as part of making the proper shebang a |
6 |
// property of the Python toolchain configuration. |
6 |
// property of the Python toolchain configuration. |
7 |
- String pythonExecutableName = OS.getCurrent() == OS.OPENBSD ? "python3" : "python"; |
7 |
- String pythonExecutableName = OS.getCurrent() == OS.OPENBSD ? "python3" : "python"; |
8 |
+ String pythonExecutable = "%%PYTHON_CMD%%"; |
8 |
+ String pythonExecutableName = "%%PYTHON_CMD%%"; |
|
|
9 |
// NOTE: keep the following line intact to support nix builds |
10 |
- String pythonShebang = "#!/usr/bin/env " + pythonExecutableName; |
11 |
+ String pythonShebang = "#!" + pythonExecutableName; |
9 |
ruleContext.registerAction( |
12 |
ruleContext.registerAction( |
10 |
new SpawnAction.Builder() |
13 |
new SpawnAction.Builder() |
11 |
.addInput(zipFile) |
14 |
.addInput(zipFile) |
12 |
.addOutput(executable) |
|
|
13 |
.setShellCommand( |
14 |
shExecutable, |
15 |
- "echo '#!/usr/bin/env " |
16 |
- + pythonExecutableName |
17 |
+ "echo '#!" |
18 |
+ + pythonExecutable |
19 |
+ "' | cat - " |
20 |
+ zipFile.getExecPathString() |
21 |
+ " > " |