Skip to contentSkip to conversation

Set path in #! line of pygrub, too

PATCH New Ian Jackson 1 participant 1 message Aug 24, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Set path in #! line of pygrub, too

pygrub currently has a hardcoded path of /usr/bin/python which is not correct if the version of python at install time is not the same as that at build time. This patch uses the existing install-wrap and python/get-path machinery.

(It does not address the currently-existing bug that the get-path machinery works by assuming that `python' is a symlink, rather than querying the python interpreter for its version.)

tools/Rules.mk +5 -0
diff -r 8b0f1f37e145 tools/Rules.mk
@@ -49,6 +49,11 @@
                         "Xen requires at least gcc-3.4")
 $(eval $(check-y))
 
+DEFAULT_PYTHON_PATH := $(shell $(XEN_ROOT)/tools/python/get-path)
+PYTHON_PATH ?= $(DEFAULT_PYTHON_PATH)
+INSTALL_PYTHON_PROG = \
+	$(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH)" $(INSTALL_PROG)
+
 %.opic: %.c
 	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
 
tools/misc/Makefile +0 -5
diff -r 8b0f1f37e145 tools/misc/Makefile
@@ -24,11 +24,6 @@
 
 INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm xen-tmem-list-parse gtraceview gtracestat xen-hvmctx
 INSTALL_SBIN := $(INSTALL_SBIN-y)
-
-DEFAULT_PYTHON_PATH := $(shell $(XEN_ROOT)/tools/python/get-path)
-PYTHON_PATH ?= $(DEFAULT_PYTHON_PATH)
-INSTALL_PYTHON_PROG = $(XEN_ROOT)/tools/python/install-wrap \
-"$(PYTHON_PATH)" $(INSTALL_PROG)
 
 .PHONY: all
 all: build
tools/pygrub/Makefile +1 -0
diff -r 8b0f1f37e145 tools/pygrub/Makefile
@@ -12,6 +12,7 @@
 install: all
 	CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \
 		$(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
+	$(INSTALL_PYTHON_PROG) src/pygrub $(DESTDIR)/$(BINDIR)/pygrub
 	$(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot
 
 .PHONY: clean
tools/pygrub/src/pygrub +1 -1
diff -r 8b0f1f37e145 tools/pygrub/src/pygrub
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#! /usr/bin/env python
 #
 # pygrub - simple python-based bootloader for Xen
 #