All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] python3: customize the python interpreter for nativesdk
@ 2021-02-22  1:21 Yu, Mingli
  2021-02-22  8:59 ` [OE-core] " Alexander Kanavin
  0 siblings, 1 reply; 2+ messages in thread
From: Yu, Mingli @ 2021-02-22  1:21 UTC (permalink / raw)
  To: openembedded-core

From: Mingli Yu <mingli.yu@windriver.com>

Make sure the python interpreter is "#!/usr/bin/env python3" for
nativesdk to avoid the shebang path exceeding the limit when install
the sdk under the directory with long path.

Before:
 $ cd ${target_sdk_dir}
 $ vi ./sysroots/x86_64-oesdk-linux/usr/bin/2to3
 #!${target_sdk_dir}/sysroots/${SDK_SYS}/usr/bin/python3.9
 [snip]

After:
 $ cd ${target_sdk_dir}
 $ vi ./sysroots/x86_64-oesdk-linux/usr/bin/2to3
 #!/usr/bin/env python3
 [snip]

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
 meta/recipes-devtools/python/python3_3.9.2.bb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/recipes-devtools/python/python3_3.9.2.bb b/meta/recipes-devtools/python/python3_3.9.2.bb
index 87231f97a6..9c87d9d2eb 100644
--- a/meta/recipes-devtools/python/python3_3.9.2.bb
+++ b/meta/recipes-devtools/python/python3_3.9.2.bb
@@ -177,6 +177,10 @@ do_install_append() {
 }
 
 do_install_append_class-nativesdk () {
+    # Make sure we use /usr/bin/env python
+    for PYTHSCRIPT in `grep -rIl ${bindir}/python ${D}${bindir}`; do
+         sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT
+    done
     create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1'
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [OE-core] [PATCH] python3: customize the python interpreter for nativesdk
  2021-02-22  1:21 [PATCH] python3: customize the python interpreter for nativesdk Yu, Mingli
@ 2021-02-22  8:59 ` Alexander Kanavin
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Kanavin @ 2021-02-22  8:59 UTC (permalink / raw)
  To: Yu, Mingli; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 1723 bytes --]

Is it possible to avoid the use of sed, and fix the problem at the source?
Why is it specific to nativesdk and doesn't show up in target?

Alex

On Mon, 22 Feb 2021 at 02:22, Yu, Mingli <mingli.yu@windriver.com> wrote:

> From: Mingli Yu <mingli.yu@windriver.com>
>
> Make sure the python interpreter is "#!/usr/bin/env python3" for
> nativesdk to avoid the shebang path exceeding the limit when install
> the sdk under the directory with long path.
>
> Before:
>  $ cd ${target_sdk_dir}
>  $ vi ./sysroots/x86_64-oesdk-linux/usr/bin/2to3
>  #!${target_sdk_dir}/sysroots/${SDK_SYS}/usr/bin/python3.9
>  [snip]
>
> After:
>  $ cd ${target_sdk_dir}
>  $ vi ./sysroots/x86_64-oesdk-linux/usr/bin/2to3
>  #!/usr/bin/env python3
>  [snip]
>
> Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
> ---
>  meta/recipes-devtools/python/python3_3.9.2.bb | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/meta/recipes-devtools/python/python3_3.9.2.bb
> b/meta/recipes-devtools/python/python3_3.9.2.bb
> index 87231f97a6..9c87d9d2eb 100644
> --- a/meta/recipes-devtools/python/python3_3.9.2.bb
> +++ b/meta/recipes-devtools/python/python3_3.9.2.bb
> @@ -177,6 +177,10 @@ do_install_append() {
>  }
>
>  do_install_append_class-nativesdk () {
> +    # Make sure we use /usr/bin/env python
> +    for PYTHSCRIPT in `grep -rIl ${bindir}/python ${D}${bindir}`; do
> +         sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT
> +    done
>      create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN}
> TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo'
> PYTHONNOUSERSITE='1'
>  }
>
> --
> 2.17.1
>
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 2679 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-22  9:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-22  1:21 [PATCH] python3: customize the python interpreter for nativesdk Yu, Mingli
2021-02-22  8:59 ` [OE-core] " Alexander Kanavin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.