setup: simplify version check

A tuple comparison is equivalent to the more complicated check,
and exit() is the same as raise SystemExit().
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-09-30 08:55:16 +02:00
parent 52c55cc42e
commit 2d5322a645

View File

@ -11,10 +11,8 @@ import sys, os
def check_version_info():
vi = sys.version_info
if vi.major > 3 or (vi.major == 3 and vi[1:3] >= (7, 0)):
return
raise SystemExit(
'calibre requires python >= 3.7.0. Current python version: ' + '.'.join(map(str, vi[:3])))
if vi < (3, 7):
exit('calibre requires Python >= 3.7.0. Current Python version: ' + '.'.join(map(str, vi[:3])))
check_version_info()