diff mbox series

[2/2] python, pygrub: pass DISTUTILS env vars as setup.py args

Message ID 20200210043516.1996-3-christopher.w.clark@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/2] pygrub: fix python3 cross-compile: install with INSTALL_PYTHON_PROG | expand

Commit Message

Christopher Clark Feb. 10, 2020, 4:35 a.m. UTC
Allow to respect the target install dir (PYTHON_SITEPACKAGES_DIR)
as well as other parameters set by the OpenEmbedded build system.
This is especially useful when the target libdir is not the default one
(/usr/lib), but for example /usr/lib64.

Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>

This enables the distro build system to pass additional args to the
python setup.py build and install commands.
Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com>
---
Original patch from the Yocto/OpenEmbedded meta-virtualization layer.
Rewrapped and rebased onto the adjacent commit submitted in this series.

 tools/pygrub/Makefile | 6 ++++--
 tools/python/Makefile | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

Comments

Ian Jackson Feb. 10, 2020, 4:10 p.m. UTC | #1
Christopher Clark writes ("[PATCH 2/2] python, pygrub: pass DISTUTILS env vars as setup.py args"):
> Allow to respect the target install dir (PYTHON_SITEPACKAGES_DIR)
> as well as other parameters set by the OpenEmbedded build system.
> This is especially useful when the target libdir is not the default one
> (/usr/lib), but for example /usr/lib64.
> 
> Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
> 
> This enables the distro build system to pass additional args to the
> python setup.py build and install commands.
> Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com>

Thanks.  The overall idea here is very sound and I would like to take
this patch in some form.  But, and I hope this is not too annoying, I
have a couple of observations/questions:

Firstly, the commit message mentions PYTHON_SITEPACKAGES_DIR which is
a thing which does not appears in this commit.  AIUI the OpenEmbedded
build system honours that and implements it by setting
DISTUTILS_BUILD_ARGS and DISTUTILS_INSTALL_ARGS.  I think this needs
to be explained correctly in the commit message.

Secondly, it bothers me that the env var name does not mention python
at all.  Would it be OK to change it to PYDISTUTILS_... or something ?

Thanks,
Ian.
diff mbox series

Patch

diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile
index b4f6f10ddd..430ceeed16 100644
--- a/tools/pygrub/Makefile
+++ b/tools/pygrub/Makefile
@@ -10,14 +10,16 @@  INSTALL_LOG = build/installed_files.txt
 all: build
 .PHONY: build
 build:
-	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py build
+	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \
+		setup.py build $(DISTUTILS_BUILD_ARGS)
 
 .PHONY: install
 install: all
 	$(INSTALL_DIR) $(DESTDIR)/$(bindir)
 	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \
 		setup.py install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
-		 --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force
+		 --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force \
+		$(DISTUTILS_INSTALL_ARGS)
 	rm -f $(DESTDIR)/$(LIBEXEC_BIN)/pygrub
 	$(INSTALL_PYTHON_PROG) src/pygrub $(DESTDIR)/$(LIBEXEC_BIN)/pygrub
 	set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \
diff --git a/tools/python/Makefile b/tools/python/Makefile
index e99f78a537..294f8ee4dd 100644
--- a/tools/python/Makefile
+++ b/tools/python/Makefile
@@ -10,7 +10,7 @@  INSTALL_LOG = build/installed_files.txt
 
 .PHONY: build
 build:
-	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py build
+	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py build $(DISTUTILS_BUILD_ARGS)
 
 .PHONY: install
 install:
@@ -18,7 +18,7 @@  install:
 
 	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \
 		setup.py install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
-		--root="$(DESTDIR)" --force
+		--root="$(DESTDIR)" --force $(DISTUTILS_INSTALL_ARGS)
 
 	$(INSTALL_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_PROG) scripts/verify-stream-v2 $(DESTDIR)$(LIBEXEC_BIN)