File: find_python.sh

package info (click to toggle)
subversion 1.4.2dfsg1-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 37,268 kB
  • ctags: 32,888
  • sloc: ansic: 406,472; python: 38,378; sh: 15,248; cpp: 9,604; ruby: 8,313; perl: 5,308; java: 4,576; lisp: 3,860; xml: 3,298; makefile: 856
file content (17 lines) | stat: -rwxr-xr-x 404 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

# Required version of Python
# Python 2.0 = 0x2000000
# Python 2.2 = 0x2020000
VERSION=${1:-0x2000000}

for pypath in "$PYTHON" "$PYTHON2" python python2; do
  if [ "x$pypath" != "x" ]; then
    DETECT_PYTHON="import sys;sys.exit((sys.hexversion < $VERSION) and 1 or 0)"
    if "$pypath" -c "$DETECT_PYTHON" >/dev/null 2>/dev/null; then
      echo $pypath
      exit 0
    fi
  fi
done
exit 1