]> arthur.barton.de Git - bup.git/blob - dev/validate-python
MetaStoreWriter.__del__: replace with context management
[bup.git] / dev / validate-python
1 #!/usr/bin/env bash
2
3 set -ueo pipefail
4
5 die () { echo "Usage: validate-python PYTHON_EXECUTABLE"; }
6
7 test $# -eq 1 || { usage 1>&2 ; exit 2; }
8 python="$1"
9
10 majver=$("$python" -c 'import sys; print(sys.version_info[0])')
11 minver=$("$python" -c 'import sys; print(sys.version_info[1])')
12
13 # May not be correct yet, i.e. actual requirement may be higher.
14 if test "$majver" -gt 2 -a "$minver" -lt 3; then
15     # utime follow_symlinks >= 3.3
16     bup_version_str=$("$python" --version 2>&1)
17     echo "ERROR: found $bup_version_str (must be >= 3.3 if >= 3)" 1>&2
18     exit 2
19 fi