diff mbox series

Regarding the issue of adding a symbolic link from python to python3

Message ID PH8PR11MB69284EC66E641DB6521B904EB8A12@PH8PR11MB6928.namprd11.prod.outlook.com
State New
Headers show
Series Regarding the issue of adding a symbolic link from python to python3 | expand

Commit Message

Song, Jiaying (CN) July 15, 2024, 6:31 a.m. UTC
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.
From: Jiaying Song <jiaying.song.cn@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.cn@windriver.com>
---
 meta/recipes-devtools/python/python3_3.12.4.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

patchtest@automation.yoctoproject.org July 15, 2024, 6:51 a.m. UTC | #1
Thank you for your submission. Patchtest identified one
or more issues with the patch. Please see the log below for
more information:

---
Testing patch /home/patchtest/share/mboxes/Regarding-the-issue-of-adding-a-symbolic-link-from-python-to-python3.patch

FAIL: test shortlog format: Commit shortlog (first line of commit message) should follow the format "<target>: <summary>" (test_mbox.TestMbox.test_shortlog_format)

PASS: pretest src uri left files (test_metadata.TestMetadata.pretest_src_uri_left_files)
PASS: test CVE check ignore (test_metadata.TestMetadata.test_cve_check_ignore)
PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test lic files chksum modified not mentioned (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
PASS: test src uri left files (test_metadata.TestMetadata.test_src_uri_left_files)

SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: test CVE tag format: No new CVE patches introduced (test_patch.TestPatch.test_cve_tag_format)
SKIP: test Signed-off-by presence: No new CVE patches introduced (test_patch.TestPatch.test_signed_off_by_presence)
SKIP: test Upstream-Status presence: No new CVE patches introduced (test_patch.TestPatch.test_upstream_status_presence_format)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)
SKIP: test target mailing list: Series merged, no reason to check other mailing lists (test_mbox.TestMbox.test_target_mailing_list)

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this
email with an explanation of why the patch should be accepted. If you
believe these results are due to an error in patchtest, please submit a
bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category
under 'Yocto Project Subprojects'). For more information on specific
failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank
you!
Alexander Kanavin July 15, 2024, 12:41 p.m. UTC | #2
On Mon, 15 Jul 2024 at 08:31, Song, Jiaying (CN) via
lists.openembedded.org
<Jiaying.Song.CN=windriver.com@lists.openembedded.org> wrote:
> 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

Fedora and Debian take option one for now, but I do think we should
just go ahead and provide /usr/bin/python from the core package. If
someone is *still* using python 2.x (the public layer is not
supporting anything after kirkstone but people can do private hacks),
they can undo that provision with a .bbappend easily. Meanwhile we'll
be able to drop a whole lot of patches that tweak #! in scripts.

Can you send the second patch as an email with 'git send-email'?
Please adjust the title to say: 'python3: provide /usr/bin/python as a
symlink to python3'.

Alex
diff mbox series

Patch

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"