The trunk can use the main server again (for the time being).
[switzerland.git] / switzerland-server
blobb44a455a771bfc1586ef9aeb3e8d67c974e2bb7b
1 #!/usr/bin/env python
3 import sys
4 import os,os.path
6 def check_version():
7 if sys.version_info < (2,4,0):
8 # This is a bad start, but let's see if there is a python2.4 around:
9 backup_plan = False
10 if "PATH" in os.environ:
11 for dir in os.environ["PATH"].split(os.pathsep):
12 if os.path.exists(dir + os.sep + "python2.4"):
13 backup_plan = True
15 if not backup_plan:
16 print "Unfortunately you need Python 2.4 or later to run Switzerland."
17 print "Please install Python 2.4+"
18 print "(or send us a patch so that Switzerland runs with your version of Python ;)"
19 sys.exit(1)
20 else:
21 print "It looks like Python2.4 is installed on your system, but it is not the"
22 print 'default Python version. Try running switzerland using "python2.4" '
23 print 'instead of "python"'
24 sys.exit(0)
26 check_version()
28 try:
29 from switzerland.server import Switzerland
30 except ImportError:
31 import sys
32 sys.path.append('/usr/local/lib/python2.5/site-packages/')
33 sys.path.append('/usr/lib/python2.5/site-packages/')
34 sys.path.append('.')
36 try:
37 from switzerland.server import Switzerland
38 except ImportError:
39 print >> sys.stderr, \
40 'Error: cannot load server. Please check your $PYTHONPATH.'
41 sys.exit(1)
43 Switzerland.main()