aboutsummaryrefslogtreecommitdiffstats
path: root/tools/python/install-wrap
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-12-09 10:58:52 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-12-09 10:58:52 +0000
commit80b20a2fa03aca3f5da93827879e9d3aeed7dade (patch)
tree6ef5bffa658f66abece3c8019db5c14f09d1dd12 /tools/python/install-wrap
parent5f05fba8c1826f6f8132c46d9215b25598f5eb39 (diff)
downloadxen-80b20a2fa03aca3f5da93827879e9d3aeed7dade.tar.gz
xen-80b20a2fa03aca3f5da93827879e9d3aeed7dade.tar.bz2
xen-80b20a2fa03aca3f5da93827879e9d3aeed7dade.zip
tools: simplify PYTHON_PATH computation (and fixes for NetBSD)
Doesn't work when build-time python path differs from install-time. Do we care about this given tools should be packaged/built for the specific run-time distro? Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Diffstat (limited to 'tools/python/install-wrap')
-rwxr-xr-xtools/python/install-wrap52
1 files changed, 34 insertions, 18 deletions
diff --git a/tools/python/install-wrap b/tools/python/install-wrap
index 29db25d1a7..00e2014016 100755
--- a/tools/python/install-wrap
+++ b/tools/python/install-wrap
@@ -1,44 +1,60 @@
-#! /usr/bin/env bash
+#!/bin/sh
# usage:
# .../install-wrap $(PYTHON_PATH) install <options-to-install> <src>... <dest>
# 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
-pythonpath="$1"; shift
+if test $# -lt 2; then
+ echo >&2 "${0##*/}: too few arguments"
+ exit 1
+fi
-install=("$1"); shift
-srcs=()
+pythonpath="$1"
+shift
+
+install="$1"
+shift
+srcs=""
while [ $# != 0 ]; do
case "$1" in
- -|--) install=("${install[@]}" "$1"); shift; break ;;
- -*) install=("${install[@]}" "$1"); shift ;;
- *) break ;;
+ -|--) install=`echo "${install} $1"`
+ shift
+ break
+ ;;
+ -*) install=`echo "${install} $1"`
+ shift
+ ;;
+ *) break
+ ;;
esac
done
-while [ $# -gt 1 ]; do
- srcs=("${srcs[@]}" "$1"); shift
+
+while test $# -gt 1; do
+ srcs=`echo "${srcs} $1"`
+ shift
done
-dest="$1"; shift
+
+dest="$1"
+shift
destf="$dest"
-for srcf in "${srcs[@]}"; do
+for srcf in ${srcs}; do
if test -d "$dest"; then
- destf="$dest/${srcf%%*/}";
+ destf="$dest/${srcf%%*/}"
fi
org="$(sed -n '2q; /^#! *\/usr\/bin\/env python *$/p' $srcf)"
- if [ "x$org" = x ]; then
- "${install[@]}" "$srcf" "$destf"
+ if test "x$org" = x; then
+ eval "${install} $srcf $destf"
continue
fi
tmpf="$destf.tmp"
- "${install[@]}" "$srcf" "$tmpf"
+ eval "${install} $srcf $tmpf"
printf >"$tmpf" "#!%s\n" "$pythonpath"
sed -e 1d "$srcf" >>"$tmpf"
mv -f "$tmpf" "$destf"
done
+exit 0