This repository has been archived by the owner on Dec 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
configure.py
executable file
·66 lines (55 loc) · 1.74 KB
/
configure.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
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python
import sys
import os
cfg_python_only = False
d = os.path.dirname(__file__)
if not d:
d = "."
os.chdir(d)
print "Checking for python version...", sys.version.replace("\n", " ")
if sys.hexversion < 0x02060000:
print >>sys.stderr, "ERROR: Python 2.6 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 "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'"