File: any-python

package info (click to toggle)
snapd 2.49-1%2Bdeb11u2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 36,432 kB
  • sloc: ansic: 12,125; sh: 8,453; python: 2,163; makefile: 1,284; exp: 173; xml: 22
file content (17 lines) | stat: -rwxr-xr-x 497 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
# Use any-python as interpreter in portable Python scripts.
# Instead of /usr/bin/env python use /usr/bin/env any-python
# The preferred choices are: Python 3, Python 2, anything called "python"
py3="$(command -v python3)"
py2="$(command -v python2)"
py_dunno="$(command -v python)"
if [ -n "$py3" ]; then
    exec "$py3" "$@"
elif [ -n "$py2" ]; then
	exec "$py2" "$@"
elif [ -n "$py_dunno" ]; then
	exec "$py_dunno" "$@"
else
	echo "cannot find any Python installation" >&2
	exit 1
fi