ia64/xen-unstable

view tools/check/check_twisted @ 2422:2274a0386cc9

bitkeeper revision 1.1159.69.5 (4138e882jA1YaR_OfTfNHe_uT4PDIg)

trivial
author iap10@labyrinth.cl.cam.ac.uk
date Fri Sep 03 21:56:18 2004 +0000 (2004-09-03)
parents bf56990784b2
children 0a4b76b6b5a0
line source
1 #!/usr/bin/env python
2 # CHECK-INSTALL
3 # -*- mode: python; -*-
5 import os
6 import sys
8 def hline():
9 print >>sys.stderr, "*" * 70
11 def msg(message):
12 print >>sys.stderr, "*" * 3, message
14 def check_twisted_version():
15 """Check twisted is installed with a supported version and print a warning if not.
16 Raises an error if twisted is not installed.
17 """
18 # Supported twisted release and major version.
19 RELEASE = 1
20 MAJOR = 3
21 try:
22 from twisted.copyright import version
23 except ImportError:
24 hline()
25 msg("The Twisted framework is not installed.")
26 msg("Use 'make install-twisted' at the xen root to install.")
27 msg("")
28 msg("Alternatively download and install version %d.%d or higher" % (RELEASE, MAJOR))
29 msg("from http://www.twistedmatrix.com/products")
30 hline()
31 sys.exit(1)
33 (release, major, minor) = version.split('.')
34 release = int(release)
35 major = int(major)
36 if release > RELEASE: return
37 if release == RELEASE and major >= MAJOR: return
38 hline()
39 msg("Warning: Twisted version not supported: %s" % version)
40 msg("Use Twisted version %d.%d.0 or higher" % (RELEASE, MAJOR))
41 hline()
42 sys.exit(1)
44 if __name__ == '__main__':
45 check_twisted_version()