All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Gray <jsg@jsg.id.au>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3] Makefile: honor PYTHON configuration properly
Date: Tue, 15 Aug 2017 01:35:23 +1000	[thread overview]
Message-ID: <20170814153523.GA90545@largo.jsg.id.au> (raw)
In-Reply-To: <20170814065911.5806-1-u@pkh.me>

On Mon, Aug 14, 2017 at 08:59:11AM +0200, Cl??ment B??sch wrote:
> On some systems `python` is `python3` (for instance, Archlinux). The
> `PYTHON` variable can be used to point to `python2` to have a successful
> build.
> 
> The use of `PYTHON` is currently limited in the Makefile and needs to be
> extended in other places:
> 
> First, pylibfdt is required to be a Python 2 binding (binman imports
> pylibfdt and is only compatible Python 2), so its setup.py needs to be
> called accordingly. An alternative would be to change the libfdt
> setup.py shebang to python2, but the binding is actually portable. Also,
> it would break on system where there is no such thing as `python2`.
> 
> Secondly, the libfdt import checks need to be done against Python 2 as
> well since the Python 2 compiled modules (in this case _libdft.so) can
> not be imported from Python 3.
> 
> Note on the libfdt imports: "@if ! PYTHONPATH=tools $(PYTHON) -c 'import
> libfdt'; then..." is probably simpler than the currently sub-optimal
> pipe.

Reviewed-by: Jonathan Gray <jsg@jsg.id.au>

This is also helpful for OpenBSD where python 2 is not 'python' or
'python2' but rather 'python2.7'.

> ---
>  Makefile             | 2 +-
>  scripts/Makefile.spl | 2 +-
>  tools/Makefile       | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 50a002e72f..1f70144e0a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1378,7 +1378,7 @@ $(timestamp_h): $(srctree)/Makefile FORCE
>  	$(call filechk,timestamp.h)
>  
>  checkbinman: tools
> -	@if ! ( echo 'import libfdt' | ( PYTHONPATH=tools python )); then \
> +	@if ! ( echo 'import libfdt' | ( PYTHONPATH=tools $(PYTHON) )); then \
>  		echo >&2; \
>  		echo >&2 '*** binman needs the Python libfdt library.'; \
>  		echo >&2 '*** Either install it on your system, or try:'; \
> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> index ac3c2c7f13..c47248cc57 100644
> --- a/scripts/Makefile.spl
> +++ b/scripts/Makefile.spl
> @@ -356,7 +356,7 @@ ifneq ($(cmd_files),)
>  endif
>  
>  checkdtoc: tools
> -	@if ! ( echo 'import libfdt' | ( PYTHONPATH=tools python )); then \
> +	@if ! ( echo 'import libfdt' | ( PYTHONPATH=tools $(PYTHON) )); then \
>  		echo '*** dtoc needs the Python libfdt library. Either '; \
>  		echo '*** install it on your system, or try:'; \
>  		echo '***'; \
> diff --git a/tools/Makefile b/tools/Makefile
> index 0743677dc8..1940cdad1f 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -138,7 +138,7 @@ tools/_libfdt.so: $(LIBFDT_SRCS) $(LIBFDT_SWIG)
>  		CPPFLAGS="$(_hostc_flags)" OBJDIR=tools \
>  		SOURCES="$(LIBFDT_SRCS) tools/libfdt.i" \
>  		SWIG_OPTS="-I$(srctree)/lib/libfdt -I$(srctree)/lib" \
> -		$(libfdt_tree)/pylibfdt/setup.py --quiet build_ext \
> +		$(PYTHON) $(libfdt_tree)/pylibfdt/setup.py build_ext \
>  			--build-lib tools
>  
>  ifneq ($(CONFIG_MX23)$(CONFIG_MX28),)
> -- 
> 2.14.1
> 

  reply	other threads:[~2017-08-14 15:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-13 21:04 [U-Boot] [PATCH] Makefile: honor PYTHON configuration properly Clément Bœsch
2017-08-13 21:20 ` Tom Rini
2017-08-13 22:36   ` Clément Bœsch
2017-08-14  3:10 ` Jonathan Gray
2017-08-14  6:59   ` [U-Boot] [PATCH v3] " Clément Bœsch
2017-08-14 15:35     ` Jonathan Gray [this message]
2017-08-20 23:29     ` [U-Boot] [U-Boot, " Tom Rini

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=20170814153523.GA90545@largo.jsg.id.au \
    --to=jsg@jsg.id.au \
    --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.