All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] libfdt: fix build with Python 3
Date: Wed, 5 Apr 2017 19:26:32 +0200	[thread overview]
Message-ID: <a5aa69de-7c08-c9a5-7ba0-028083f7d754@denx.de> (raw)
In-Reply-To: <202c891c8a231c6c6f67fc907a58288d@agner.ch>

Hi Stefan,

On 04/04/2017 20:44, Stefan Agner wrote:
> On 2017-04-04 01:53, Stefano Babic wrote:
>> Hi Stefan,
>>
>> On 03/04/2017 23:02, Stefan Agner wrote:
>>
>>> But then, I don't expect that "/usr/bin/env python" is looking at
>>> PYTHON.
>>>
>>> As far as I understand env, it just looks up the current environment to
>>> run its COMMAND argument.
>>
>> Agree, this is also mz understanding.
>>
>>> It is helpful as a shebang, but it does not
>>> seem to make any difference to calling "python" directly (since that
>>> also just looks up the current environment PATH and executes the first
>>> python it finds...
>>
>> Agree - so that is disturbing is the fix calls to "python" inside
>> Makefile. That means it remains to change:
>>
>> tools/_libfdt.so: $(patsubst %.o,%.c,$(LIBFDT_OBJS)) tools/libfdt_wrap.c
>> 	LDFLAGS="$(HOSTLDFLAGS)" CFLAGS= python $(srctree)/lib/libfdt/setup.py
>>
>> to:
>>
>> tools/_libfdt.so: $(patsubst %.o,%.c,$(LIBFDT_OBJS)) tools/libfdt_wrap.c
>> 	LDFLAGS="$(HOSTLDFLAGS)" CFLAGS= ${PYTHON} $(srctree)/lib/libfdt/setup.py
>>
> 
> On my host
> 
> $ echo Python is \"$PYTHON\"
> Python is ""
> 

Sent a patch today, easier to test.

The thing is that PYTHON is set into the main Makefile as "python", and
this should not break your build. At least, I hope so...

> Wouldn't that break regular builds? Probably wouldn't since shebang
> kicks in, but is that really what we want?

The main Makefile already sets most tools to default if they are not
current set. This should ensure that the normal build works, but should
even allow to override it from command line - or adding EXTRA_OEMAKE in
recipe.

> 
> What I thought OE was doing is adding the native/x86_64 sysroots in your
> path at the beginning,

Right.

> which should already make sure that a regular
> "python" call executes OE python... 

"nativepython" should have a symbolic link to "python", but what I noted
is some mix between distro and SDK.

> But maybe there is more to it,
> especially since setup.py even compiles things...

Right. I have seen in some recipes that /usr/bin/env is replaced, for
example:

meta/recipes-support/createrepo/createrepo_0.4.11.bb:		sed -i -e
's|^#!.*/usr/bin/env python|#! /usr/bin/env nativepython|' $i

There are a few of recipes doing this.

> 
> Maybe we need to peek into distutils/setuptools class to understand how
> that works for regular Python modules:
> https://github.com/openembedded/openembedded/blob/master/classes/setuptools.bbclass
> https://github.com/openembedded/openembedded/blob/master/classes/distutils.bbclass

But there are for building python-modules, and we are just simply want
to build u-boot. Then, if I understand your concept, we need to build a
python module outside u-boot, and built before u-boot (ok, I am just
thinking about Yocto build..), as nativesdk-pythonsetuppy or whatever,
and this is just called when u-boot is built. But this makes things much
more complicated...

Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

  reply	other threads:[~2017-04-05 17:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29 19:41 [U-Boot] [PATCH] libfdt: fix build with Python 3 Stefan Agner
2017-04-01  4:23 ` Simon Glass
2017-04-05 18:08   ` Stefan Agner
2017-04-05 18:11     ` Simon Glass
2017-04-10 20:52       ` Simon Glass
2017-06-25 21:59         ` Stephen Arnold
2017-04-03 10:30 ` Stefano Babic
2017-04-03 16:41   ` Stefan Agner
2017-04-03 17:35     ` Stefano Babic
2017-04-03 21:02       ` Stefan Agner
2017-04-04  8:53         ` Stefano Babic
2017-04-04 18:44           ` Stefan Agner
2017-04-05 17:26             ` Stefano Babic [this message]
2017-04-05 18:05               ` Stefan Agner

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=a5aa69de-7c08-c9a5-7ba0-028083f7d754@denx.de \
    --to=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    /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.