diff options
author | Jacek Konieczny <jajcus@jajcus.net> | 2006-07-24 01:26:12 +0400 |
---|---|---|
committer | Jacek Konieczny <jajcus@jajcus.net> | 2006-07-24 01:26:12 +0400 |
commit | 4d7fa399264d3278102c5b953e2335bfcb6493f7 (patch) | |
tree | 6dc9a354e119a419913476d6d5a31b4b8356001a /configure.py | |
parent | 622936c28fab5dd026e7aa454f76d8c25fadde8d (diff) |
- simple configure.py script (fixes #2)
Diffstat (limited to 'configure.py')
-rwxr-xr-x | configure.py | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/configure.py b/configure.py new file mode 100755 index 0000000..c811eec --- /dev/null +++ b/configure.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +import sys +import os + + +cfg_python_only = False + + +os.chdir(os.path.dirname(__file__)) + +print "Checking for python version...", sys.version.replace("\n", " ") +if sys.hexversion < 0x02030000: + print >>sys.stderr, "ERROR: Python 2.3 or newer is required" + sys.exit(1) + +print "Checking for dnspython...", +try: + import dns.resolver + import dns.version +except ImportError: + print "not found" + print >>sys.stderr, "ERROR: You need dnspython from http://www.dnspython.org/" + sys.exit(1) +print "version %s found" % (dns.version.version,) + +print "Checking for libxml2 python bindings...", +try: + import libxml2 +except ImportError: + print "not found" + print >>sys.stderr, "ERROR: You need libxml2 python bindings for PyXMPP" + sys.exit(1) +print "found" + +print "Checking for M2Crypto...", +try: + from M2Crypto import SSL + from M2Crypto.SSL import SSLError + import M2Crypto.SSL.cb +except ImportError: + print "not found" + print >>sys.stderr, "Warning: You need M2Crypto (some good version) for StartTLS support in PyXMPP" +print "version %s found. Hope it will work." % (M2Crypto.version,) + +print "Trying to build the binary extension...", +build_cfg = file("build.cfg", "w") +print >>build_cfg, "python_only = False" +build_cfg.close() +try: + os.system("python setup.py clean --all >/dev/null 2>&1") + ret = os.system("python setup.py build_ext >build_test.log 2>&1") +except OSError: + ret = -1 +if ret: + print "failed" + print >>sys.stderr, "Warning: Couldn't build the binary extension. Python or libxml2 devel files are missing. Will use python-only implementation." + print >>sys.stderr, "See build_test.log file for failure details." + cfg_python_only = True +else: + print "success" + os.unlink("build_test.log") + cfg_python_only = False + +# Write build.cfg + +build_cfg = file("build.cfg", "w") +print >>build_cfg, "python_only =", cfg_python_only +build_cfg.close() + +print +print "Configuration successfull" +print "You may now build pyxmpp with 'python setup.py build'" +print "and install it with 'python setup.py install'" |