#!/bin/sh
#
# setpython - create a local link from 'python' to a specified version
#
# This script is used to to redirect the 'python' in reposurgeon's
# shebang line to a specified version when running regression tests.

if [ $1 = python -o $1 = python2 -o $1 = python3 ]
then
	p=`command -v $1`
	case $p in
		*/bin/*) ln -sf $p ./python; echo "python -> $p";;
		*)
			saved=`readlink ./python 2>/dev/null`
			rm -f ./python
			;;
	esac
else
	echo "setpython: unrecognized python version" >&2
	exit 1
fi
