-# this is separate to allow us to use python 2.5 syntax without\r
-# the dependency checker breaking on earlier versions.\r
-\r
-import sys\r
-import subprocess\r
-import os\r
-\r
-def fail(*message):\r
- print >>sys.stderr, "\n".join(message)\r
- sys.exit(1)\r
- \r
-def warn(*message):\r
- print >>sys.stderr, "warning:", "\nwarning: ".join(message), "\n"\r
-\r
-def check_dependencies():\r
- i = 0\r
- \r
- check_twisted()\r
- check_zope()\r
- check_win32()\r
- i+=check_autobahn()\r
- i+=check_json()\r
- i+=check_java()\r
- i+=check_hg()\r
-\r
- print "0 errors, %d warnings." % i\r
- \r
- if i == 0:\r
- print "looks like you've got everything you need to run qwebirc!"\r
- else:\r
- print "you can run qwebirc despite these."\r
-\r
- f = open(".checked", "w")\r
- f.close()\r
- \r
-def check_win32():\r
- if not sys.platform.startswith("win"):\r
- return\r
- \r
- try:\r
- import win32con\r
- except ImportError:\r
- fail("qwebirc requires pywin32, see:", "http://sourceforge.net/project/showfiles.php?group_id=78018")\r
- \r
-def check_java():\r
- def java_warn(specific):\r
- 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/")\r
- \r
- try:\r
- p = subprocess.Popen(["java", "-version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=os.name == "nt")\r
- p.communicate()\r
- if p.wait() != 0:\r
- java_warn("something went wrong looking for java.")\r
- return 1\r
- except: # ugh\r
- java_warn("couldn't find java.")\r
- return 1\r
- \r
- return 0\r
- \r
-def check_hg():\r
- def hg_warn(specific):\r
- 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/")\r
- \r
- try:\r
- p = subprocess.Popen(["hg", "id"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=os.name == "nt")\r
- p.communicate()\r
- if p.wait() != 0:\r
- hg_warn("something went wrong looking for mercurial.")\r
- return 1\r
- except: # ugh\r
- hg_warn("couldn't find mercurial.")\r
- return 1\r
- \r
- return 0\r
- \r
-def check_zope():\r
- try:\r
- from zope.interface import Interface\r
- except ImportError:\r
- if sys.platform.startswith("win"):\r
- fail("qwebirc requires zope interface",\r
- "see pypi: http://pypi.python.org/pypi/zope.interface")\r
- else:\r
- fail("qwebirc requires zope interface.",\r
- "this should normally come with twisted, but can be downloaded",\r
- "from pypi: http://pypi.python.org/pypi/zope.interface")\r
-\r
-def check_twisted():\r
- try:\r
- import twisted\r
- except ImportError:\r
- fail("qwebirc requires twisted (at least 8.2.0), see http://twistedmatrix.com/")\r
-\r
- def twisted_fail(x, y=None):\r
- fail("you don't seem to have twisted's %s module." % x,\r
- "your distro is most likely modular, look for a twisted %s package%s." % (x, " %s" % y if y else "",))\r
-\r
- try:\r
- import twisted.names\r
- except ImportError:\r
- twisted_fail("names")\r
-\r
- try:\r
- import twisted.mail\r
- except ImportError:\r
- twisted_fail("mail")\r
-\r
- try:\r
- import twisted.web\r
- except ImportError:\r
- twisted_fail("web", "(not web2)")\r
-\r
- try:\r
- import twisted.words\r
- except ImportError:\r
- twisted_fail("words")\r
- \r
-def check_json():\r
- import qwebirc.util.qjson\r
- if qwebirc.util.qjson.slow:\r
- warn("simplejson module with C speedups not installed.",\r
- "using embedded module (slower); consider installing simplejson from:",\r
- "http://pypi.python.org/pypi/simplejson/")\r
- return 1\r
- return 0\r
-\r
-def check_autobahn():\r
- try:\r
- import autobahn, autobahn.websocket\r
- x = autobahn.version.split(".")\r
- if len(x) != 3:\r
- raise ImportError("Unknown version: %s", autobahn.vesrion)\r
- if (int(x[1]) < 8) or (int(x[1]) == 8 and int(x[2]) < 14):\r
- raise ImportError()\r
- return 0\r
- except ImportError:\r
- warn("autobahn 0.8.14 (minimum) not installed; websocket support will be disabled.",\r
- "consider installing autobahn from:",\r
- "http://autobahn.ws/python/getstarted/")\r
- return 1\r
-\r
-if __name__ == "__main__":\r
- import dependencies\r
- dependencies.check_dependencies()\r
+# 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)
+ sys.exit(1)
+
+def warn(*message):
+ print >>sys.stderr, "warning:", "\nwarning: ".join(message), "\n"
+
+def check_dependencies():
+ i = 0
+
+ check_zope()
+ check_twisted()
+ check_win32()
+ i+=check_autobahn()
+ i+=check_json()
+ i+=check_java()
+ i+=check_git()
+
+ print "0 errors, %d warnings." % i
+
+ if i == 0:
+ print "looks like you've got everything you need to run qwebirc!"
+ else:
+ print "you can run qwebirc despite these."
+
+ f = open(".checked", "w")
+ f.close()
+
+def check_win32():
+ if not sys.platform.startswith("win"):
+ return
+
+ try:
+ import win32con
+ except ImportError:
+ fail("qwebirc requires pywin32, see:", "http://sourceforge.net/project/showfiles.php?group_id=78018")
+
+def check_java():
+ def java_warn(specific):
+ 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, shell=os.name == "nt")
+ p.communicate()
+ if p.wait() != 0:
+ java_warn("something went wrong looking for java.")
+ return 1
+ except: # ugh
+ java_warn("couldn't find java.")
+ return 1
+
+ return 0
+
+def check_git():
+ def git_warn(specific):
+ warn(specific, "git is not required, but allows qwebirc to save bandwidth by versioning.")
+
+ try:
+ p = subprocess.Popen(["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=os.name == "nt")
+ p.communicate()
+ if p.wait() != 0:
+ git_warn("something went wrong looking for git.")
+ return 1
+ except: # ugh
+ git_warn("couldn't find git.")
+ return 1
+
+ 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/")
+
+ 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
+ except ImportError:
+ twisted_fail("names")
+
+ try:
+ import twisted.mail
+ except ImportError:
+ twisted_fail("mail")
+
+ try:
+ import twisted.web
+ except ImportError:
+ twisted_fail("web", "(not web2)")
+
+ try:
+ import twisted.words
+ except ImportError:
+ 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():
+ import qwebirc.util.autobahn_check as autobahn_check
+ v = autobahn_check.check()
+ if v == True:
+ return 0
+
+ if v == False:
+ warn("autobahn not installed; websocket support will be disabled.",
+ "consider installing autobahn from:",
+ "http://autobahn.ws/python/getstarted/")
+ return 1
+
+ warn("error loading autobahn: %s; websocket support will be disabled." % v,
+ "consider installing/upgrading autobahn from:",
+ "http://autobahn.ws/python/getstarted/")
+ return 1
+
+if __name__ == "__main__":
+ import dependencies
+ dependencies.check_dependencies()