File: setpython

package info (click to toggle)
deheader 1.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 488 kB
  • sloc: python: 1,191; ansic: 334; xml: 191; makefile: 71; sh: 15
file content (24 lines) | stat: -rwxr-xr-x 551 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
#
# setpython - create a local link from 'python' to a specified version
#
# This script is used to to redirect the 'python' in a shebang line to
# a specified version when running regression tests.

if [ "$1" = python ] || [ "$1" = python2 ] || [ "$1" = python3 ]
then
	p=$(command -v "$1")
	case $p in
	    */bin/*)
		# shellcheck disable=SC2086
		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