X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/blobdiff_plain/a352efb826be6c0341d22203cdb7fe9d0af51950..00238eb840d539a30fe92d33f7d1507b0073c25f:/bin/dependencies_b.py diff --git a/bin/dependencies_b.py b/bin/dependencies_b.py index d5b1619..746860a 100644 --- a/bin/dependencies_b.py +++ b/bin/dependencies_b.py @@ -1,8 +1,9 @@ -# this is seperate to allow us to use python 2.5 syntax without +# this is separate to allow us to use python 2.5 syntax without # the dependency checker breaking on earlier versions. import sys import subprocess +import os def fail(*message): print >>sys.stderr, "\n".join(message) @@ -13,12 +14,15 @@ def warn(*message): def check_dependencies(): i = 0 - + + check_zope() check_twisted() check_win32() + i+=check_autobahn() + i+=check_json() i+=check_java() i+=check_hg() - + print "0 errors, %d warnings." % i if i == 0: @@ -43,7 +47,7 @@ def check_java(): warn(specific, "java is not required, but allows qwebirc to compress output,", "making it faster to download.", "you can get java at http://www.java.com/") try: - p = subprocess.Popen(["java", "-version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.Popen(["java", "-version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=os.name == "nt") p.communicate() if p.wait() != 0: java_warn("something went wrong looking for java.") @@ -59,7 +63,7 @@ def check_hg(): warn(specific, "mercurial (hg) is not required, but allows qwebirc to save bandwidth by versioning.", "you can get hg at http://www.selenic.com/mercurial/") try: - p = subprocess.Popen(["hg", "id"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.Popen(["hg", "id"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=os.name == "nt") p.communicate() if p.wait() != 0: hg_warn("something went wrong looking for mercurial.") @@ -70,14 +74,27 @@ def check_hg(): return 0 +def check_zope(): + try: + from zope.interface import Interface + except ImportError: + if sys.platform.startswith("win"): + fail("qwebirc requires zope interface", + "see pypi: http://pypi.python.org/pypi/zope.interface") + else: + fail("qwebirc requires zope interface.", + "this should normally come with twisted, but can be downloaded", + "from pypi: http://pypi.python.org/pypi/zope.interface") + def check_twisted(): try: import twisted except ImportError: fail("qwebirc requires twisted (at least 8.2.0), see http://twistedmatrix.com/") - twisted_fail = lambda x, y=None: fail("you don't seem to have twisted's %s module." % x, - "your distro is most likely modular, look for a twisted web package%s." % (" %s" % y if y else "",)) + def twisted_fail(x, y=None): + fail("you don't seem to have twisted's %s module." % x, + "your distro is most likely modular, look for a twisted %s package%s." % (x, " %s" % y if y else "",)) try: import twisted.names @@ -88,7 +105,6 @@ def check_twisted(): import twisted.mail except ImportError: twisted_fail("mail") - fail("you don't seem to have twisted's mail module, your distro is most likely modular, look for a twisted mail package.") try: import twisted.web @@ -98,7 +114,31 @@ def check_twisted(): try: import twisted.words except ImportError: - twistedfail("words") + twisted_fail("words") + +def check_json(): + import qwebirc.util.qjson + if qwebirc.util.qjson.slow: + warn("simplejson module with C speedups not installed.", + "using embedded module (slower); consider installing simplejson from:", + "http://pypi.python.org/pypi/simplejson/") + return 1 + return 0 + +def check_autobahn(): + try: + import autobahn, autobahn.twisted.websocket + x = autobahn.version.split(".") + if len(x) != 3: + raise ImportError() + if (int(x[1]) < 8) or (int(x[1]) == 8 and int(x[2]) < 14): + raise ImportError() + return 0 + except ImportError: + warn("autobahn 0.8.14 (minimum) not installed; websocket support will be disabled.", + "consider installing autobahn from:", + "http://autobahn.ws/python/getstarted/") + return 1 if __name__ == "__main__": import dependencies