grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* Patch: allow the 'python' used to run gentpl.py to be configured
@ 2018-07-04 17:08 Adam Williamson
  2018-07-06 17:25 ` Daniel Kiper
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Williamson @ 2018-07-04 17:08 UTC (permalink / raw)
  To: grub-devel, pjones

[-- Attachment #1: Type: text/plain, Size: 725 bytes --]

A patch from Jonathan McCune back in 2015 allowed build-time
configuration of the python interpreter used in autogen.sh. However,
this doesn't cover the whole build process, as we still have use of
'python' hardcoded into Makefile.common when running gentpl.py (the
script's own shebang is ignored). This patch allows you to set the make
variable 'PYTHONBIN' to change the interpreter used to run gentpl.py.
With this, it's possible to build grub on Fedora with 'PYTHON=python3
autogen.sh' and 'make PYTHONBIN=python3', without python2 installed at
all, and the build succeeds.
-- 
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Twitter: AdamW_Fedora | XMPP: adamw AT happyassassin . net
http://www.happyassassin.net

[-- Attachment #2: 0001-Make-python-interpreter-used-to-run-gentpl.py-config.patch --]
[-- Type: text/x-patch, Size: 1887 bytes --]

From 111e9d54c1c5bd57d65d09549831cb6c4a37f530 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Wed, 4 Jul 2018 09:55:52 -0700
Subject: [PATCH] Make python interpreter used to run gentpl.py configurable

gentpl.py is python2/3-agnostic, but there's no way to cause it
to be run with any interpreter other than 'python', it's just
hard-coded into Makefile.common that way. Adjust that to allow
a make variable PYTHONBIN to be set to the desired interpreter.
This will make it easier in situations where we specifically
want to build with 'python2' or 'python3' or whatever.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
 conf/Makefile.common | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/conf/Makefile.common b/conf/Makefile.common
index 311da61c6..a6e05cd91 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -5,6 +5,9 @@ CFLAGS_PLATFORM=
 export LC_COLLATE := C
 unexport LC_ALL
 
+# default python is 'python', can be overridden
+PYTHONBIN = python
+
 # Platform specific options
 if COND_sparc64_ieee1275
   LDFLAGS_PLATFORM = -Wl,-melf64_sparc
@@ -128,11 +131,11 @@ BUILT_SOURCES =
 
 .PRECIOUS: $(top_srcdir)/Makefile.util.am
 $(top_srcdir)/Makefile.util.am: $(top_srcdir)/gentpl.py $(top_srcdir)/Makefile.util.def $(top_srcdir)/Makefile.utilgcry.def
-	python $^ > $@.new || (rm -f $@.new; exit 1)
+	$(PYTHONBIN) $^ > $@.new || (rm -f $@.new; exit 1)
 	mv $@.new $@
 
 .PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am
 $(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/gentpl.py $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def
 	if [ "x$$GRUB_CONTRIB" != x ]; then echo "You need to run ./autogen.sh manually." >&2; exit 1; fi
-	python $^ > $@.new || (rm -f $@.new; exit 1)
+	$(PYTHONBIN) $^ > $@.new || (rm -f $@.new; exit 1)
 	mv $@.new $@
-- 
2.18.0.rc2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-09-19 12:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-04 17:08 Patch: allow the 'python' used to run gentpl.py to be configured Adam Williamson
2018-07-06 17:25 ` Daniel Kiper
2018-07-06 20:19   ` Adam Williamson
2018-07-09  9:25     ` Daniel Kiper
2018-07-17 19:35     ` Adam Williamson
2018-09-14  4:04       ` Adam Williamson
2018-09-14 10:02         ` Daniel Kiper
2018-09-19 12:43       ` Daniel Kiper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).