Merge pull request #985 from robertbaldyga/min-python-version-check
Better minimum python version check
This commit is contained in:
commit
91c7aa2361
18
utils/casctl
18
utils/casctl
@ -1,18 +1,26 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# Copyright(c) 2012-2021 Intel Corporation
|
# Copyright(c) 2012-2021 Intel Corporation
|
||||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from packaging import version
|
||||||
|
import platform
|
||||||
|
import sys
|
||||||
|
|
||||||
|
min_ver = version.parse("3.6")
|
||||||
|
ver = version.parse(platform.python_version())
|
||||||
|
if ver < min_ver:
|
||||||
|
print((f"Minimum required python version is {min_ver}\n"
|
||||||
|
f"Detected python version is {ver}"),
|
||||||
|
file = sys.stderr)
|
||||||
|
exit(1)
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
|
|
||||||
import opencas
|
import opencas
|
||||||
|
|
||||||
if sys.version_info < (3, 6):
|
|
||||||
raise RuntimeError('At least Python 3.6 is required')
|
|
||||||
|
|
||||||
def eprint(*args, **kwargs):
|
def eprint(*args, **kwargs):
|
||||||
print(*args, file=sys.stderr, **kwargs)
|
print(*args, file=sys.stderr, **kwargs)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user