Skip to contentSkip to conversation

replace /usr/bin/env python -> python3

PATCH In review Robert Berger 5 participants 5 messages Aug 2, 2023 – Aug 15, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 replace /usr/bin/env python -> python3

---
 meta-oe/recipes-devtools/uftrace/uftrace_0.13.1.bb | 1 +
 1 file changed, 1 insertion(+)
meta-oe/recipes-devtools/uftrace/uftrace_0.13.1.bb +1 -0
index 4e1edc6ce..851acd745 100644
@@ -30,6 +30,7 @@ EXTRA_UFTRACE_OECONF = "ARCH=${@set_target_arch(d)} \
                         with_elfutils=/use/libelf/from/sysroot"
 
 do_configure() {
+    find . -type f -exec sed -i 's/#!\/usr\/bin\/env python/#!\/usr\/bin\/env python3/g' {} +
     ${S}/configure ${EXTRA_UFTRACE_OECONF}
 }
 
Signature · 1 line
2.17.1
#1 lore raw

Does it work when you re-execute do_configure or do you get python33? I think you should anchor the regexp with '$'.

Quoted 34 lines · Robert Berger
---
 meta-oe/recipes-devtools/uftrace/uftrace_0.13.1.bb | 1 +
 1 file changed, 1 insertion(+)
meta-oe/recipes-devtools/uftrace/uftrace_0.13.1.bb +1 -0
index 4e1edc6ce..851acd745 100644
@@ -30,6 +30,7 @@ EXTRA_UFTRACE_OECONF = "ARCH=${@set_target_arch(d)} \
                         with_elfutils=/use/libelf/from/sysroot"
 
 do_configure() {
+    find . -type f -exec sed -i 's/#!\/usr\/bin\/env

python/#!\/usr\/bin\/env python3/g' {} +

     ${S}/configure ${EXTRA_UFTRACE_OECONF}

}

--
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#104204):
https://lists.openembedded.org/g/openembedded-devel/message/104204
Mute This Topic: https://lists.openembedded.org/mt/100509860/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Hi,

Quoted 1 line · Martin Jansa

Does it work when you re-execute do_configure or do you get python33? I think you should anchor the regexp with '$'.

I think you are right - Let me play around a bit and I'll send v2.

Signature · 11 lines
Robert Berger
Embedded Software Evangelist

Reliable Embedded Systems
Consulting Training Engineering
URL: https://www.reliableembeddedsystems.com

Schedule a web meeting:
https://calendly.com/reliableembeddedsystems/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
#3 lore raw
Quoted 9 lines · Robert Berger

Hi,

Quoted 2 lines · Martin Jansa

Does it work when you re-execute do_configure or do you get python33? I think you should anchor the regexp with '$'.

I think you are right - Let me play around a bit and I'll send v2.

You can also use '1s' to only change the first line.

NOTE: the subject should include the package being fixed, otherwise it sounds global which it is not
" uftrace: replace /usr/bin/env python -> python3"

Quoted 24 lines

Robert Berger
Embedded Software Evangelist

Reliable Embedded Systems
Consulting Training Engineering
URL: https://www.reliableembeddedsystems.com

Schedule a web meeting:
https://calendly.com/reliableembeddedsystems/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#104206):
https://lists.openembedded.org/g/openembedded-devel/message/104206
Mute This Topic: https://lists.openembedded.org/mt/100509860/924729
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw

It is also better to do a change like this using a patch rather than with sed. Because if upstream changes the shebang line of the script or removes it, the patch will no longer apply and someone will update it or remove it, whereas the sed command may remain long after it is no longer needed.

//Peter

From: [email protected] <[email protected]> On Behalf Of Tim Orling
Sent: den 2 augusti 2023 20:26
To: Robert Berger <[email protected]>
Cc: Martin Jansa <[email protected]>; Robert Berger <[email protected]>; [email protected]; Robert Berger <[email protected]>
Subject: Re: [oe] [meta-oe][PATCH] replace /usr/bin/env python -> python3

On Wed, Aug 2, 2023 at 10:17 AM Robert Berger <[email protected]<mailto:[email protected]>> wrote:
Hi,

Quoted 2 lines · Martin Jansa

Does it work when you re-execute do_configure or do you get python33? I think you should anchor the regexp with '$'.

I think you are right - Let me play around a bit and I'll send v2. You can also use '1s' to only change the first line.

NOTE: the subject should include the package being fixed, otherwise it sounds global which it is not " uftrace: replace /usr/bin/env python -> python3"

--
Robert Berger
Embedded Software Evangelist

Reliable Embedded Systems
Consulting Training Engineering
URL: https://www.reliableembeddedsystems.com

Schedule a web meeting:
https://calendly.com/reliableembeddedsystems/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--