Makefile: honor PYTHON configuration properly
PATCH 1/1 Makefile: honor PYTHON configuration properly
--- Makefile | 2 +- tools/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
@@ -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:'; \
tools/Makefile +1 -1
@@ -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),)
Signature · 1 line
2.14.1
PATCH 1/1 Makefile: honor PYTHON configuration properly
Quoted 23 lines · Clément Bœsch
--- Makefile | 2 +- tools/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)Makefile +1
-1@@ -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:'; \tools/Makefile +0
-0
tools/Makefile tools/_libfdt.so: $(LIBFDT_SRCS) $(LIBFDT_SWIG) · line 144
Quoted 8 lines
tools/Makefile +1
-1@@ -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),)
A blank commit message here is not enough. Where are you seeing what type of problems? Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170813/bd71be16/attachment.sig>
PATCH 1/1 Makefile: honor PYTHON configuration properly
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 to at 2 other cases:
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 check of the libfdt import needs to be check against specificed Python 2 path since the Python 2 compiled modules (in this case _libdft.so) are not compatible with Python 3.
Note on the libfdt import: "@if $(PYTHON) -c 'import libfdt'; then..." is probably simpler than the currently overkill sub-shells.
--- Makefile | 2 +- tools/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
@@ -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:'; \
tools/Makefile +1 -1
@@ -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),)
Signature · 1 line
2.14.0
PATCH 1/1 Makefile: honor PYTHON configuration properly
In reply to Clément BœschQuoted 4 lines · Cl??ment B??sch
--- Makefile | 2 +- tools/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
There is a similiar fragment in scripts/Makefile.spl with the checkdtoc target that should also be fixed.
checkdtoc: tools
@if ! ( echo 'import libfdt' | ( PYTHONPATH=tools python )); then \
Quoted 34 lines
Makefile +1
-1@@ -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:'; \tools/Makefile +1
-1@@ -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),)Signature · 6 lines
2.14.1 _______________________________________________ U-Boot mailing list U-Boot at lists.denx.de https://lists.denx.de/listinfo/u-boot
PATCH v3 1/1 Makefile: honor PYTHON configuration properly
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.
--- Makefile | 2 +- scripts/Makefile.spl | 2 +- tools/Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
Makefile +1 -1
@@ -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:'; \
scripts/Makefile.spl +1 -1
@@ -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 '***'; \
tools/Makefile +1 -1
@@ -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),)
Signature · 1 line
2.14.1
PATCH v3 1/1 Makefile: honor PYTHON configuration properly
Quoted 13 lines · Cl??ment B??sch
On some systems
pythonispython3(for instance, Archlinux). ThePYTHONvariable can be used to point topython2to have a successful build.The use of
PYTHONis currently limited in theMakefileand 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.pyneeds to be called accordingly. An alternative would be to change the libfdtsetup.pyshebang to python2, but the binding is actually portable. Also, it would break on system where there is no such thing aspython2.
Quoted 7 lines
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.
This is also helpful for OpenBSD where python 2 is not 'python' or 'python2' but rather 'python2.7'.
Quoted 48 lines
--- Makefile | 2 +- scripts/Makefile.spl | 2 +- tools/Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)Makefile +1
-1@@ -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:'; \scripts/Makefile.spl +1
-1@@ -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 '***'; \tools/Makefile +1
-1@@ -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),)Signature · 1 line
2.14.1
PATCH v3 1/1 Makefile: honor PYTHON configuration properly
In reply to Clément BœschQuoted 13 lines · Clément Bœsch
On some systems
pythonispython3(for instance, Archlinux). ThePYTHONvariable can be used to point topython2to have a successful build.The use of
PYTHONis currently limited in theMakefileand 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.pyneeds to be called accordingly. An alternative would be to change the libfdtsetup.pyshebang to python2, but the binding is actually portable. Also, it would break on system where there is no such thing aspython2.
Quoted 8 lines
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 <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170820/e773b557/attachment.sig>