aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-devtools/bazel/files/0001-python3.patch
blob: 50eaaf45fc697f5d84a430a5eabac4a5b19eb6c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From f3dcad42a53e78efdb87adbc98121dc66b53ec5f Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Sun, 5 Apr 2020 23:40:31 +0800
Subject: [PATCH] set python3 interpreter

Since many distrobution choose python3, and drop python2,
If host does not provides `python', python rules failed
...
/usr/bin/env: 'python': No such file or directory
...

set python3 interpreter to shebang

Upstream-Status: Inappropriate [wr-installer specific]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 .../build/lib/bazel/rules/python/BazelPythonSemantics.java      | 2 +-
 .../build/lib/bazel/rules/python/python_stub_template.txt       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java
index 0ff5d15..997cfc9 100755
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java
@@ -185,7 +185,7 @@ public class BazelPythonSemantics implements PythonSemantics {
                 .addOutput(executable)
                 .setShellCommand(
                     shExecutable,
-                    "echo '#!/usr/bin/env python' | cat - "
+                    "echo '#!/usr/bin/env python3' | cat - "
                         + zipFile.getExecPathString()
                         + " > "
                         + executable.getExecPathString())
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt
index 129ce90..959e3a5 100755
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 import os
 import re
-- 
2.17.1