forked from lhupfeldt/jenkinsflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
py_version_check.py
34 lines (22 loc) · 945 Bytes
/
py_version_check.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import sys
import os.path
error_msg = """
`{pkg}` 4.0+ supports Python {min_sup_version} and above.
When using Python 2.7, 3.4 - 3.5.x please install {pkg} 3.x
Python {py} detected.
Make sure you have pip >= 9.0 as well as setuptools >= 24.2 to avoid these kinds of issues:
$ pip install pip setuptools --upgrade
Your choices:
- Upgrade to Python {min_sup_version}+.
- Install an older version of {pkg}:
$ pip install '{pkg}<9.0'
It would be great if you can figure out how this version ended up being
installed, and try to check how to prevent that for future users.
Source: https://github.com/lhupfeldt/{pkg}
"""
min_sup_version = (3, 6, 0)
if sys.version_info < min_sup_version:
raise ImportError(error_msg.format(
py='.'.join([str(vv) for vv in sys.version_info[:3]]),
pkg=os.path.basename(os.path.dirname(os.path.abspath(__file__))),
min_sup_version='.'.join([str(vv) for vv in min_sup_version])))