forked from swcarpentry/installation-testing-scripts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
swc-installation-test-1.py
executable file
·56 lines (36 loc) · 1.45 KB
/
swc-installation-test-1.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python
"""Test script to check required Python version.
Execute this code at the command line by typing:
python swc-installation-test-1.py
How to get a command line:
- On OSX run this with the Terminal application.
- On Windows, go to the Start menu, select 'Run' and type 'cmd'
(without the quotes) to run the 'cmd.exe' Windows Command Prompt.
- On Linux, either use your login shell directly, or run one of a
number of graphical terminals (e.g. 'xterm', 'gnome-terminal', ...).
For some screen shots, see:
http://software-carpentry.org/setup/terminal.html
Run the script and follow the instructions it prints at the end. If
you see an error saying that the 'python' command was not found, than
you may not have any version of Python installed. See:
http://www.python.org/download/releases/2.7.3/#download
for installation instructions.
This test is separate to avoid Python syntax errors parsing the more
elaborate `swc-installation-test-2.py`.
"""
import sys as _sys
__version__ = '0.1'
def check():
if _sys.version_info < (3, 5):
print('check for Python version (python):')
print('outdated version of Python: ' + _sys.version)
return False
return True
if __name__ == '__main__':
if check():
print('Passed')
else:
print('Failed')
print('Install a current version of Python!')
print('http://www.python.org/download/releases/2.7.3/#download')
_sys.exit(1)