From: Stefan Agner Date: Tue, 04 Apr 2017 11:44:17 -0700 Subject: [U-Boot] [PATCH] libfdt: fix build with Python 3 In-Reply-To: <53ee8ef7-0095-e795-d549-113b5fcbd86f@denx.de> References: <20170329194123.2361-1-stefan@agner.ch> <75845614f03ce96f25f9206a178e5033@agner.ch> <53ee8ef7-0095-e795-d549-113b5fcbd86f@denx.de> Message-ID: <202c891c8a231c6c6f67fc907a58288d@agner.ch> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 "" Wouldn't that break regular builds? Probably wouldn't since shebang kicks in, but is that really what we want? What I thought OE was doing is adding the native/x86_64 sysroots in your path at the beginning, which should already make sure that a regular "python" call executes OE python... But maybe there is more to it, especially since setup.py even compiles things... 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 -- Stefan