X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/blobdiff_plain/79221dd0eff9868b13ecda50d13c0348b5a96784..5e83905fb952c62b861844797603e4b081cc1b5d:/bin/dependencies_b.py diff --git a/bin/dependencies_b.py b/bin/dependencies_b.py index d5b1619..bada449 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,9 +14,11 @@ def warn(*message): def check_dependencies(): i = 0 - + + check_zope() check_twisted() check_win32() + i+=check_json() i+=check_java() i+=check_hg() @@ -43,7 +46,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 +62,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 +73,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 +104,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,8 +113,17 @@ 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 + if __name__ == "__main__": import dependencies dependencies.check_dependencies()