All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Joshua Watt" <JPEWhacker@gmail.com>
To: Khem Raj <raj.khem@gmail.com>
Cc: Ross Burton <ross@burtonini.com>,
	OE-core <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH] waf: explicitly run waf under Python 3
Date: Wed, 14 Oct 2020 16:23:52 -0500	[thread overview]
Message-ID: <02ab658d-eef9-de6c-b826-a2a2a77c8b2d@gmail.com> (raw)
In-Reply-To: <CAMKF1soMBC6dk0DvaG=HjUD+Y0h4uh5LMkiNOJptxRibt_e=jQ@mail.gmail.com>


On 10/14/20 4:01 PM, Khem Raj wrote:
> On Wed, Oct 14, 2020 at 5:41 AM Joshua Watt <JPEWhacker@gmail.com> wrote:
>>
>>
>> On Wed, Oct 14, 2020, 6:26 AM Ross Burton <ross@burtonini.com> wrote:
>>> We don't assume Python 2 is on the host and don't expose an unversioned
>>> python in HOSTTOOLS, but waf uses the unversion python binary.
>>>
>>> Typically this is solved by patching waf (see the glmark2 recipe) but
>>> this can be solved centrally by invoking python3 directly.  All wscripts
>>> that needed Python 2 would have been fixed by now.
>>>
>>> Signed-off-by: Ross Burton <ross.burton@arm.com>
>>> ---
>>>   meta/classes/waf.bbclass | 8 ++++----
>>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/meta/classes/waf.bbclass b/meta/classes/waf.bbclass
>>> index 309f625a40..df6d4d53e8 100644
>>> --- a/meta/classes/waf.bbclass
>>> +++ b/meta/classes/waf.bbclass
>>> @@ -42,7 +42,7 @@ python waf_preconfigure() {
>>>       subsrcdir = d.getVar('S')
>>>       wafbin = os.path.join(subsrcdir, 'waf')
>>>       try:
>>> -        result = subprocess.check_output([wafbin, '--version'], cwd=subsrcdir, stderr=subprocess.STDOUT)
>>> +        result = subprocess.check_output(['python3', wafbin, '--version'], cwd=subsrcdir, stderr=subprocess.STDOUT)
>>
>> This will break our internal usage... We still use waf 1 which runs under python 2 only :(, although we are working on transitioning
> this is for master and we have already said goodbye to python2 in
> oe-core. perhaps reverse patching waf in your app might be an option ?

a.k.a. upgrading to waf 2 :)

Can we deal with it by importing either `pythonnative` or 
`python3native` in the recipes along with waf.bbclass, e.g.

     inherit waf pythonnative # waf 1

or

     inherit waf python3native # waf 2

Then you get the interpreter than matches the waf in your repo.

I do appreciate that oe-core has dumped python 2 support (and we should 
have *ages* ago also)... but I also don't really want a fire drill when 
most of our applications no longer build on 3.2, especially we can just 
inherit python3native as shown.

>
>>>           version = result.decode('utf-8').split()[1]
>>>           if StrictVersion(version) >= StrictVersion("1.8.7"):
>>>               d.setVar("WAF_EXTRA_CONF", "--bindir=${bindir} --libdir=${libdir}")
>>> @@ -55,16 +55,16 @@ python waf_preconfigure() {
>>>   do_configure[prefuncs] += "waf_preconfigure"
>>>
>>>   waf_do_configure() {
>>> -       (cd ${S} && ./waf configure -o ${B} --prefix=${prefix} ${WAF_EXTRA_CONF} ${EXTRA_OECONF})
>>> +       (cd ${S} && python3 ./waf configure -o ${B} --prefix=${prefix} ${WAF_EXTRA_CONF} ${EXTRA_OECONF})
>>>   }
>>>
>>>   do_compile[progress] = "outof:^\[\s*(\d+)/\s*(\d+)\]\s+"
>>>   waf_do_compile()  {
>>> -       (cd ${S} && ./waf build ${@oe.utils.parallel_make_argument(d, '-j%d', limit=64)} ${EXTRA_OEWAF_BUILD})
>>> +       (cd ${S} && python3 ./waf build ${@oe.utils.parallel_make_argument(d, '-j%d', limit=64)} ${EXTRA_OEWAF_BUILD})
>>>   }
>>>
>>>   waf_do_install() {
>>> -       (cd ${S} && ./waf install --destdir=${D} ${EXTRA_OEWAF_INSTALL})
>>> +       (cd ${S} && python3 ./waf install --destdir=${D} ${EXTRA_OEWAF_INSTALL})
>>>   }
>>>
>>>   EXPORT_FUNCTIONS do_configure do_compile do_install
>>> --
>>> 2.25.1
>>>
>>>
>>>
>>>
>> 
>>

  reply	other threads:[~2020-10-14 21:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14 11:26 [PATCH] waf: explicitly run waf under Python 3 Ross Burton
2020-10-14 12:41 ` [OE-core] " Joshua Watt
2020-10-14 21:01   ` Khem Raj
2020-10-14 21:23     ` Joshua Watt [this message]
2020-10-14 22:47       ` Khem Raj
2020-10-15 12:44   ` Richard Purdie
2020-10-15 13:00     ` Joshua Watt
2020-10-15 13:52     ` Ross Burton
  -- strict thread matches above, loose matches on Subject: below --
2020-10-08 16:23 Ross Burton
2020-10-08 19:15 ` [OE-core] " Richard Purdie

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=02ab658d-eef9-de6c-b826-a2a2a77c8b2d@gmail.com \
    --to=jpewhacker@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=raj.khem@gmail.com \
    --cc=ross@burtonini.com \
    /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.