Hello,

To resolve the issue where some shebang use /usr/bin/python, leading to the 
interpreter not being recognized, I have added a symbolic link from 
/usr/bin/python to /usr/bin/python3. Currently, I have two modification plans 
but am unsure if they are appropriate, so I would like to seek your advice:

1) Place the symbolic link in a separate package named python-is-python3. To 
use it, add this package to IMAGE_INSTALL in conf/local.conf.
The advantage of this approach is its flexibility, as you can add it when 
needed.
Reference attachment: [PATCH] Add python-is-pyton3 package

2) Add the symbolic link directly to the python3-core package, so this 
modification will take effect as long as python3 is used.
Reference attachment: [PATCH] Add Python symbolic links into the Python3-core 
package

A similar issue was resolved this way in Ubuntu 20.04:  
https://askubuntu.com/questions/1296790/python-is-python3-package-in-ubuntu-20-04-what-is-it-and-what-does-it-actually

If you have any other suggestions, I would appreciate it.

Thanks,
Jiaying.

--- Begin Message ---
From: Jiaying Song <jiaying.song...@windriver.com>

The /usr/bin/python cannot find the correct Python interpreter, so a
symbolic link is added to point it to the Python3 interpreter.

Signed-off-by: Jiaying Song <jiaying.song...@windriver.com>
---
 meta/recipes-devtools/python/python3_3.12.4.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/python/python3_3.12.4.bb 
b/meta/recipes-devtools/python/python3_3.12.4.bb
index 0cb84b91b4..af15c6f4ac 100644
--- a/meta/recipes-devtools/python/python3_3.12.4.bb
+++ b/meta/recipes-devtools/python/python3_3.12.4.bb
@@ -163,6 +163,7 @@ do_install:prepend() {
 
 do_install:append:class-target() {
         oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h
+        ln -sf ${bindir}/python3 ${D}${bindir}/python
 }
 
 do_install:append:class-native() {
@@ -424,9 +425,10 @@ FILES:${PN}-idle += "${bindir}/idle3 
${bindir}/idle${PYTHON_MAJMIN}"
 RPROVIDES:${PN}-venv += "${MLPREFIX}python3-pyvenv"
 
 # package libpython3
-PACKAGES =+ "libpython3 libpython3-staticdev"
+PACKAGES =+ "libpython3 libpython3-staticdev python-is-python3"
 FILES:libpython3 = "${libdir}/libpython*.so.*"
 FILES:libpython3-staticdev += 
"${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}-*/libpython${PYTHON_MAJMIN}.a"
+FILES:python-is-python3 += "${bindir}/python"
 INSANE_SKIP:${PN}-dev += "dev-elf"
 INSANE_SKIP:${PN}-ptest = "dev-deps"
 
-- 
2.34.1


--- End Message ---
--- Begin Message ---
From: Jiaying Song <jiaying.song...@windriver.com>

The /usr/bin/python cannot find the correct Python interpreter, so a symbolic 
link is added to point it to the Python3 interpreter.

Signed-off-by: Jiaying Song <jiaying.song...@windriver.com>
---
 meta/recipes-devtools/python/python3/python3-manifest.json | 1 +
 meta/recipes-devtools/python/python3_3.12.4.bb             | 1 +
 2 files changed, 2 insertions(+)

diff --git a/meta/recipes-devtools/python/python3/python3-manifest.json 
b/meta/recipes-devtools/python/python3/python3-manifest.json
index 46092d4004..f9259e1450 100644
--- a/meta/recipes-devtools/python/python3/python3-manifest.json
+++ b/meta/recipes-devtools/python/python3/python3-manifest.json
@@ -220,6 +220,7 @@
         "files": [
             "${bindir}/python${PYTHON_MAJMIN}",
             "${bindir}/python${PYTHON_MAJMIN}.real",
+            "${bindir}/python",
             "${bindir}/python3",
             "${includedir}/python${PYTHON_MAJMIN}/pyconfig*.h",
             "${libdir}/python${PYTHON_MAJMIN}/UserDict.py",
diff --git a/meta/recipes-devtools/python/python3_3.12.4.bb 
b/meta/recipes-devtools/python/python3_3.12.4.bb
index 0cb84b91b4..5af5e66457 100644
--- a/meta/recipes-devtools/python/python3_3.12.4.bb
+++ b/meta/recipes-devtools/python/python3_3.12.4.bb
@@ -163,6 +163,7 @@ do_install:prepend() {
 
 do_install:append:class-target() {
         oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h
+        ln -sf ${bindir}/python3 ${D}${bindir}/python
 }
 
 do_install:append:class-native() {
-- 
2.34.1


--- End Message ---
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#201898): 
https://lists.openembedded.org/g/openembedded-core/message/201898
Mute This Topic: https://lists.openembedded.org/mt/107227111/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to