Permalink
Browse files

- simple configure.py script (fixes #2)

  • Loading branch information...
Jajcus committed Jul 23, 2006
1 parent 622936c commit 4d7fa399264d3278102c5b953e2335bfcb6493f7
Showing with 84 additions and 7 deletions.
  1. +7 −0 README
  2. +1 −0 build.cfg
  3. +74 −0 configure.py
  4. +2 −7 setup.py
7 README
@@ -53,6 +53,13 @@ For PyXMPP you will need:
Installation
------------

To make sure you have all the requirements listed above or to prepare limited
(without the binary extension) build of PyXMPP you may want to run::

python configure.py

You may manually pick the limited or full build of PyXMPP by editing the build.cfg file.

To build the package just invoke::

python setup.py build
@@ -0,0 +1 @@
python_only = False
@@ -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'"
@@ -4,17 +4,12 @@
import os.path
import sys

python_only = False

if sys.hexversion<0x02030000:
raise ImportError,"Python 2.3 or newer is required"

if not os.path.exists(os.path.join("pyxmpp","version.py")):
print >>sys.stderr,"You need to run 'make' to use pyxmpp from SVN"
sys.exit(1)


execfile(os.path.join("pyxmpp","version.py"))
execfile("build.cfg")
execfile(os.path.join("pyxmpp", "version.py"))

from distutils.core import setup, Extension

0 comments on commit 4d7fa39

Please sign in to comment.