forked from SeattleTestbed/repy_v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkpythonversion.py
32 lines (22 loc) · 989 Bytes
/
checkpythonversion.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
"""
Author: Justin Cappos
Start Date: Feb 27th, 2009
Description:
Exits if they are using an unsupported Python version...
Python v2.5 and v2.6 are officially supported, v2.7 is unofficially supported.
"""
import sys
def ensure_python_version_is_supported():
# sys.version_info looks like this:
# (2, 5, 0, 'final', 0)
# Let's get the version number they have
majorversionnumber, minorversionnumber = sys.version_info[:2]
# Let's ensure they have 2.X where X is 5 or greater. According to the
# Python folks, any minor revisions will be backwards compatible. Also,
# if new features are added, safe should not allow the user to use them
# (unless they are additional arguments to an existing, allowed call).
# This should allow us to keep the VM standardized across different Python
# versions.
if majorversionnumber != 2 or minorversionnumber < 5:
print >> sys.stderr, "Python version not supported! Use 2.5.X, 2.6.X, or 2.7.X"
sys.exit(93)