Skip to contentSkip to conversation

tools: simplify install of python "binaries"

PATCH NAK Christoph Egger 2 participants 4 messages Jul 15, 2009 – Jul 16, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: simplify install of python "binaries"

Hi!

Attached patch simplifies install of python "binaries". Get rid of get-path.

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
tools/misc/Makefile +1 -2
diff -r 91407452cdb6 tools/misc/Makefile
@@ -25,8 +25,7 @@ INSTALL_BIN := $(INSTALL_BIN-y)
 INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm xen-tmem-list-parse gtraceview gtracestat
 INSTALL_SBIN := $(INSTALL_SBIN-y)
 
-DEFAULT_PYTHON_PATH := $(shell $(XEN_ROOT)/tools/python/get-path)
-PYTHON_PATH ?= $(DEFAULT_PYTHON_PATH)
+PYTHON_PATH ?= $(PYTHON)
 INSTALL_PYTHON_PROG = $(XEN_ROOT)/tools/python/install-wrap \
 "$(PYTHON_PATH)" $(INSTALL_PROG)
 
tools/python/get-path deleted +0 -22
diff -r 91407452cdb6 tools/python/get-path
@@ -1,22 +0,0 @@
-#! /usr/bin/env bash
-set -e
-
-check () {
-	set +e
-	p=`type -p python$v`
-	r=$?
-	set -e
-	if [ $r = 0 ]; then
-		echo >&2 "${0##*/}: will use #!$p for python programs"
-		printf "%s\n" "$p"
-		exit 0
-	fi
-}
-
-v="$(python -V 2>&1)"
-v="${v#* }"
-check
-v="${v%.*}"
-check
-echo >&2 'python version not determined, will use env to find python at runtime'
-printf "/usr/bin/env python\n"
tools/python/install-wrap +1 -2
diff -r 91407452cdb6 tools/python/install-wrap
@@ -4,8 +4,7 @@
 # where
 #  PYTHON_PATH is what to put after #! and may be `/usr/bin/env python'
 #
-# Used via $(INSTALL_PYTHON_PROG) in Rules.mk; PYTHON_PATH comes from
-# .../get-path alongside this script
+# Used via $(INSTALL_PYTHON_PROG) in Rules.mk; PYTHON_PATH comes from $(PYTHON)
 
 set -e
 if [ $# -lt 2 ]; then echo >&2 "${0##*/}: too few arguments"; exit 1; fi

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Nacked-by on v1 1/1 NAK
#1 lore raw

Christoph Egger writes ("[Xen-devel] [PATCH] tools: simplify install of python "binaries""):

Quoted 2 lines

Attached patch simplifies install of python "binaries". Get rid of get-path.

I don't think this is correct.

The purpose of the code you are removing here is to find out what the compile-time python version is, and then hardcode that into the #! line of the installed python scripts.

So if you compile with PYTHON=python2.4 or with PYTHON unset on a system where `python' from the path is 2.4, you generate in dist/install/ (a) python modules in .../site-packages/python2.4 and
(b) scripts starting #!/usr/bin/python2.4

If you don't do this then the script starts #!/usr/bin/python and if by then python 2.5 is installed, it won't find the modules.

Ian.

#2 lore raw
In reply to Christoph Egger
Quoted 6 lines · On Wednesday 15 July 2009 17:09:58 Christoph Egger wrote:

Hi!

Attached patch simplifies install of python "binaries". Get rid of get-path.

Previous version doesn't work due to missing part. Attached patch is the complete one.

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
Config.mk +1 -1
diff -r 91407452cdb6 Config.mk
@@ -35,7 +35,7 @@ EXTRA_INCLUDES += $(EXTRA_PREFIX)/includ
 EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
 endif
 
-PYTHON      ?= python
+PYTHON      ?= $(shell which python)
 PYTHON_PREFIX_ARG ?= --prefix="$(PREFIX)"
 # The above requires that PREFIX contains *no spaces*. This variable is here
 # to permit the user to set PYTHON_PREFIX_ARG to '' to workaround this bug:
tools/misc/Makefile +1 -2
diff -r 91407452cdb6 tools/misc/Makefile
@@ -25,8 +25,7 @@ INSTALL_BIN := $(INSTALL_BIN-y)
 INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm xen-tmem-list-parse gtraceview gtracestat
 INSTALL_SBIN := $(INSTALL_SBIN-y)
 
-DEFAULT_PYTHON_PATH := $(shell $(XEN_ROOT)/tools/python/get-path)
-PYTHON_PATH ?= $(DEFAULT_PYTHON_PATH)
+PYTHON_PATH ?= $(PYTHON)
 INSTALL_PYTHON_PROG = $(XEN_ROOT)/tools/python/install-wrap \
 "$(PYTHON_PATH)" $(INSTALL_PROG)
 
tools/python/get-path deleted +0 -22
diff -r 91407452cdb6 tools/python/get-path
@@ -1,22 +0,0 @@
-#! /usr/bin/env bash
-set -e
-
-check () {
-	set +e
-	p=`type -p python$v`
-	r=$?
-	set -e
-	if [ $r = 0 ]; then
-		echo >&2 "${0##*/}: will use #!$p for python programs"
-		printf "%s\n" "$p"
-		exit 0
-	fi
-}
-
-v="$(python -V 2>&1)"
-v="${v#* }"
-check
-v="${v%.*}"
-check
-echo >&2 'python version not determined, will use env to find python at runtime'
-printf "/usr/bin/env python\n"
tools/python/install-wrap +1 -2
diff -r 91407452cdb6 tools/python/install-wrap
@@ -4,8 +4,7 @@
 # where
 #  PYTHON_PATH is what to put after #! and may be `/usr/bin/env python'
 #
-# Used via $(INSTALL_PYTHON_PROG) in Rules.mk; PYTHON_PATH comes from
-# .../get-path alongside this script
+# Used via $(INSTALL_PYTHON_PROG) in Rules.mk; PYTHON_PATH comes from $(PYTHON)
 
 set -e
 if [ $# -lt 2 ]; then echo >&2 "${0##*/}: too few arguments"; exit 1; fi

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel