File: validate-python

package info (click to toggle)
bup 0.33.9-1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,712 kB
  • sloc: python: 15,897; sh: 5,764; ansic: 2,965; pascal: 669; makefile: 21
file content (19 lines) | stat: -rwxr-xr-x 588 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env bash

set -ueo pipefail

die () { echo "Usage: validate-python PYTHON_EXECUTABLE"; }

test $# -eq 1 || { usage 1>&2 ; exit 2; }
python="$1"

majver=$("$python" -c 'import sys; print(sys.version_info[0])')
minver=$("$python" -c 'import sys; print(sys.version_info[1])')

# May not be correct yet, i.e. actual requirement may be higher.
if test "$majver" -lt 3 || test "$majver" -eq 3 && test "$minver" -lt 7; then
    # utime follow_symlinks >= 3.3
    bup_version_str=$("$python" --version 2>&1)
    echo "ERROR: found $bup_version_str (must be >= 3.7)" 1>&2
    exit 2
fi