All of lore.kernel.org
 help / color / mirror / Atom feed
From: Khem Raj <raj.khem@gmail.com>
To: Alexander Kanavin <alex.kanavin@gmail.com>
Cc: Markus Volk <f_l_k@t-online.de>,
	openembedded-core@lists.openembedded.org
Subject: Re: [oe-core][PATCH] python3: add ${bindir}/python symlink
Date: Mon, 21 Nov 2022 07:16:49 -0800	[thread overview]
Message-ID: <CAMKF1srs_tmRRNqWQAmBKOkJkfysJt=OZjefq_mPd4htPGi6VA@mail.gmail.com> (raw)
In-Reply-To: <CANNYZj-UTuxW0-Rr7FhgjwE007Gr28Pc5ZCo=cnrDcaNsuZStw@mail.gmail.com>

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

On Sun, Nov 20, 2022 at 3:56 PM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:

> Python community has no plans for python4 whatsoever. Anything but gentle
> and steady evolution won’t be well received.
>
>
> https://www.techrepublic.com/article/programming-languages-why-python-4-0-will-probably-never-arrive-according-to-its-creator/
>

Good news article although it does not say that python3 and python are
analogous and python package does not explicitly install python binary or
symlink either so it’s left up to how distros want to presume it. If we
want to do that then it would be prudent to see what other distributions
are doing in this regard. So we are not alone in case trouble arises

>
>
> Alex
>
> On Mon 21. Nov 2022 at 0.17, Khem Raj <raj.khem@gmail.com> wrote:
>
>>
>>
>> On Sun, Nov 20, 2022 at 9:52 AM Markus Volk <f_l_k@t-online.de> wrote:
>>
>>> Currently /usr/bin/python is provided by the python2 package. If python2
>>> is not installed, the built image lacks a provider for it.
>>> This results in failed scripts when using '/usr/bin/python' shebang.
>>>
>>> This patch adds a /usr/bin/python symlink for python3 to fix this issue.
>>> For images containing python2 and python3, the do_rootfs task will fail
>>> because now both of them provide the same file.
>>> To allow this corner case, a DISTRO_FEATURE 'python2' has been
>>> introduced which,
>>> if set, will prevent python3 from creating the symlink.
>>>
>>> The link is created with relative path because using an absolute path
>>> would fail
>>> for native and nativesdk.
>>
>>
>> What happens if and when python4 comes ?
>> This might get us into same mess we had migrating python2 to 3
>>
>>
>>>
>>> Signed-off-by: Markus Volk <f_l_k@t-online.de>
>>> ---
>>>  meta/recipes-devtools/python/python3/python3-manifest.json | 1 +
>>>  meta/recipes-devtools/python/python3_3.11.0.bb             | 4 ++++
>>>  2 files changed, 5 insertions(+)
>>>
>>> diff --git a/meta/recipes-devtools/python/python3/python3-manifest.json
>>> b/meta/recipes-devtools/python/python3/python3-manifest.json
>>> index 64203cf0fc..7b6f509a45 100644
>>> --- a/meta/recipes-devtools/python/python3/python3-manifest.json
>>> +++ b/meta/recipes-devtools/python/python3/python3-manifest.json
>>> @@ -203,6 +203,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.11.0.bb
>>> b/meta/recipes-devtools/python/python3_3.11.0.bb
>>> index 92a1f69320..18b631f79d 100644
>>> --- a/meta/recipes-devtools/python/python3_3.11.0.bb
>>> +++ b/meta/recipes-devtools/python/python3_3.11.0.bb
>>> @@ -144,6 +144,7 @@ do_install:prepend() {
>>>
>>>  do_install:append:class-target() {
>>>          oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h
>>> +        ${@bb.utils.contains('DISTRO_FEATURES', 'python2', '', 'ln -sf
>>> ./python3 ${D}${bindir}/python', d)}
>>>  }
>>>
>>>  do_install:append:class-native() {
>>> @@ -156,6 +157,7 @@ do_install:append:class-native() {
>>>          # (these often end up too long for the #! parser in the kernel
>>> as the
>>>          # buffer is 128 bytes long).
>>>          ln -s python3-native/python3 ${D}${bindir}/nativepython3
>>> +        ${@bb.utils.contains('DISTRO_FEATURES', 'python2', '', 'ln -sf
>>> ./python3-native/python3 ${D}${bindir}/nativepython', d)}
>>>
>>>          # Remove the opt-1.pyc and opt-2.pyc files. There are over
>>> 3,000 of them
>>>          # and the overhead in each recipe-sysroot-native isn't worth
>>> it, particularly
>>> @@ -213,6 +215,7 @@ do_install:append() {
>>>  }
>>>
>>>  do_install:append:class-nativesdk () {
>>> +    ${@bb.utils.contains('DISTRO_FEATURES', 'python2', '', 'ln -sf
>>> ./python3 ${D}${bindir}/python', d)}
>>>      # 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
>>> @@ -376,6 +379,7 @@ RRECOMMENDS:${PN}-crypt:append:class-nativesdk = "
>>> ${MLPREFIX}openssl ${MLPREFIX
>>>
>>>  # For historical reasons PN is empty and provided by python3-modules
>>>  FILES:${PN} = ""
>>> +RPROVIDES:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'python2',
>>> '', '${bindir}/python', d)}"
>>>  RPROVIDES:${PN}-modules = "${PN}"
>>>
>>>  FILES:${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3"
>>> --
>>> 2.34.1
>>>
>>>
>>>
>>>
>>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>>
> View/Reply Online (#173642):
>> https://lists.openembedded.org/g/openembedded-core/message/173642
>> Mute This Topic: https://lists.openembedded.org/mt/95156228/1686489
>> Group Owner: openembedded-core+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
>> alex.kanavin@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
>>

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

  reply	other threads:[~2022-11-21 15:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-20 17:52 [oe-core][PATCH] python3: add ${bindir}/python symlink Markus Volk
2022-11-20 18:00 ` Alexander Kanavin
2022-11-20 18:03   ` Markus Volk
2022-11-20 23:17 ` Khem Raj
2022-11-20 23:56   ` Alexander Kanavin
2022-11-21 15:16     ` Khem Raj [this message]
2022-11-21 17:18       ` Alexander Kanavin
     [not found]       ` <1729A925BA1D06C8.25787@lists.openembedded.org>
2022-11-21 17:48         ` Alexander Kanavin
2022-11-22  4:42           ` f_l_k
2022-11-22 17:41             ` Ross Burton
2022-11-22 18:03               ` Alexander Kanavin
2022-11-22 18:14                 ` Richard Purdie
2022-11-22 18:32                   ` Alexander Kanavin
2022-11-22 22:28                     ` Alexandre Belloni
2022-11-23  5:14                       ` Peter Kjellerstedt
2022-11-23 10:06                     ` Ross Burton
2022-11-23  9:59                 ` Ross Burton
2022-11-23 10:55                   ` Alexander Kanavin
2022-11-23 16:34                     ` Khem Raj
2022-11-23 20:02                       ` Ross Burton
2022-11-22 18:13               ` Markus Volk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMKF1srs_tmRRNqWQAmBKOkJkfysJt=OZjefq_mPd4htPGi6VA@mail.gmail.com' \
    --to=raj.khem@gmail.com \
    --cc=alex.kanavin@gmail.com \
    --cc=f_l_k@t-online.de \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.