swc-installation-test-1.py: Give instructions for 'python command not found'
[swc-setup-installation-test.git] / swc-installation-test-1.py
1 #!/usr/bin/env python
2
3 """Test script to check required Python version.
4
5 Execute this code at the command line by typing:
6
7   python swc-installation-test-1.py
8
9 How to get a command line:
10
11 - On OSX run this with the Terminal application.
12
13 - On Windows, go to the Start menu, select 'Run' and type 'cmd'
14 (without the quotes) to run the 'cmd.exe' Windows Command Prompt.
15
16 - On Linux, either use your login shell directly, or run one of a
17   number of graphical terminals (e.g. 'xterm', 'gnome-terminal', ...).
18
19 Run the script and follow the instructions it prints at the end.  If
20 you see an error saying that the 'python' command was not found, than
21 you may not have any version of Python installed.  See:
22
23   http://www.python.org/download/releases/2.7.3/#download
24
25 for installation instructions.
26
27 This test is separate to avoid Python syntax errors parsing the more
28 elaborate `swc-installation-test-2.py`.
29 """
30
31 import sys as _sys
32
33
34 __version__ = '0.1'
35
36
37 def check():
38     if _sys.version_info < (2, 6):
39         print('check for Python version (python):')
40         print('outdated version of Python: ' + _sys.version)
41         return False
42     return True
43
44
45 if __name__ == '__main__':
46     if check():
47         print('Passed')
48     else:
49         print('Failed')
50         print('Install a current version of Python!')
51         print('http://www.python.org/download/releases/2.7.3/#download')