Skip to contentSkip to conversation

perf: Correct the substitution of python shebangs

PATCH Superseded [email protected] 1 participant 2 messages Feb 14, 2020

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 perf: Correct the substitution of python shebangs

From: He Zhe <[email protected]>

To make the native python3 is always used,

- Move the substitution of /usr/bin/python3 to first, otherwise the possible original /usr/bin/python3 would be changed to /usr/bin/env python33.
- Add substitution for ${S}/scripts/bpf_helpers_doc.py to fix the following warning.

File "/usr/lib/python3.6/sysconfig.py", line 421, in _init_posix _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
ModuleNotFoundError: No module named '_sysconfigdata'

This issue is first reported by Joel Stanley <[email protected]> The sed one-liner is credited to Anuj Mittal <[email protected]>

---
 meta/recipes-kernel/perf/perf.bb | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
meta/recipes-kernel/perf/perf.bb +2 -5
index 6d1b06693d..a6fb51d3db 100644
@@ -239,11 +239,8 @@ do_configure_prepend () {
     fi
 
     # use /usr/bin/env instead of version specific python
-    for s in `find ${S}/tools/perf/ -name '*.py'`; do
-        sed -i 's,/usr/bin/python,/usr/bin/env python3,' "${s}"
-        sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "${s}"
-        sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "${s}"
-        sed -i 's,/usr/bin/python3,/usr/bin/env python3,' "${s}"
+    for s in `find ${S}/tools/perf/ -name '*.py'` ${S}/scripts/bpf_helpers_doc.py; do
+        sed -i -e "s,#!.*python.*,#!${USRBINPATH}/env python3," ${s}
     done
 
     # unistd.h can be out of sync between libc-headers and the captured version in the perf source
Signature · 1 line
2.24.1
author
#1 lore raw

commit log broken. Please ignore. I'll send v3.

Zhe

Quoted 40 lines · On 2/14/20 11:44 AM, [email protected] wrote:

From: He Zhe <[email protected]>

To make the native python3 is always used,

- Move the substitution of /usr/bin/python3 to first, otherwise the possible original /usr/bin/python3 would be changed to /usr/bin/env python33.
- Add substitution for ${S}/scripts/bpf_helpers_doc.py to fix the following warning.

File "/usr/lib/python3.6/sysconfig.py", line 421, in _init_posix _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
ModuleNotFoundError: No module named '_sysconfigdata'

This issue is first reported by Joel Stanley <[email protected]> The sed one-liner is credited to Anuj Mittal <[email protected]>

---
 meta/recipes-kernel/perf/perf.bb | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
meta/recipes-kernel/perf/perf.bb +2 -5
index 6d1b06693d..a6fb51d3db 100644
@@ -239,11 +239,8 @@ do_configure_prepend () {
     fi
 
     # use /usr/bin/env instead of version specific python
-    for s in `find ${S}/tools/perf/ -name '*.py'`; do
-        sed -i 's,/usr/bin/python,/usr/bin/env python3,' "${s}"
-        sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "${s}"
-        sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "${s}"
-        sed -i 's,/usr/bin/python3,/usr/bin/env python3,' "${s}"
+    for s in `find ${S}/tools/perf/ -name '*.py'` ${S}/scripts/bpf_helpers_doc.py; do
+        sed -i -e "s,#!.*python.*,#!${USRBINPATH}/env python3," ${s}
     done
 
     # unistd.h can be out of sync between libc-headers and the captured version in the perf source