Check for a supported Python version on startup

Check that hg-fast-export is running on a supported version of Python
on startup. This is an attempt to avoid problems like #314 in the
future.
This commit is contained in:
Frej Drejhammar
2023-12-27 13:09:57 +01:00
parent efe934e16b
commit d4298a0906

View File

@@ -45,6 +45,14 @@ if [ -z "${PYTHON}" ]; then
exit 1
fi
"${PYTHON}" -c 'import sys; exit(sys.version_info.major==3 and sys.version_info.minor >= 7)'
if [ $? -eq 0 ]; then
echo "Could not find an interpreter for a supported Python version (>= 3.7)" \
"Please use the 'PYTHON' environment variable to specify the interpreter to use."
exit 1
fi
USAGE="[--quiet] [-r <repo>] [--force] [--ignore-unnamed-heads] [-m <max>] [-s] [--hgtags] [-A <file>] [-B <file>] [-T <file>] [-M <name>] [-o <name>] [--hg-hash] [-e <encoding>]"
LONG_USAGE="Import hg repository <repo> up to either tip or <max>
If <repo> is omitted, use last hg repository as obtained from state file,