Commit aee69fca5b9880b2c22115f4e01d9c1e7ed00586
- Diff rendering mode:
- inline
- side by side
getdeps.py
(55 / 0)
|   | |||
| 1 | #!/usr/bin/python | ||
| 2 | ### This file is part of KoFooBot. This file is not licensed and belongs to Public Domain. ### | ||
| 3 | |||
| 4 | import os | ||
| 5 | |||
| 6 | files = [('http://feedparser.googlecode.com/svn/trunk/feedparser', 'feedparser', '.py')] | ||
| 7 | |||
| 8 | for dfile in files: | ||
| 9 | base_url, name, ending = dfile | ||
| 10 | url = "%s/%s%s" % dfile | ||
| 11 | filename = "%s%s" % (name, ending) | ||
| 12 | if os.path.exists(filename): | ||
| 13 | print "%s already exists." % filename | ||
| 14 | else: | ||
| 15 | print "Downloading '%s'." % filename | ||
| 16 | ret = os.system('wget -q %s' % url) | ||
| 17 | if ret: | ||
| 18 | print " - Failed to download." | ||
| 19 | else: | ||
| 20 | print " + Successfull." | ||
| 21 | |||
| 22 | modules = [('http://downloads.sourceforge.net/sourceforge/python-irclib', 'python-irclib', '0.4.8', 'tar.gz', ['irclib.py']), | ||
| 23 | ('http://pypi.python.org/packages/source/s/simplejson', 'simplejson', '2.0.9', 'tar.gz', []), | ||
| 24 | ('http://python-twitter.googlecode.com/files', 'python-twitter', '0.6', 'tar.gz', ['twitter.py']), | ||
| 25 | ('http://downloads.sourceforge.net/sourceforge/mwclient', 'mwclient', '0.6.2', 'tar.gz', [])] | ||
| 26 | |||
| 27 | for module in modules: | ||
| 28 | base_url, name, version, format, req_files = module | ||
| 29 | filename = "%s-%s.%s" % (name, version, format) | ||
| 30 | if os.path.exists(filename): | ||
| 31 | print "%s already exists." % filename | ||
| 32 | ret = 0 | ||
| 33 | else: | ||
| 34 | url = "%s/%s" % (base_url, filename) | ||
| 35 | print "Downloading '%s' version %s." % (name, version) | ||
| 36 | ret = os.system('wget -q %s' % url) | ||
| 37 | if ret: | ||
| 38 | print " - Download failed." | ||
| 39 | else: | ||
| 40 | ret = os.system('tar xf %s' % filename) | ||
| 41 | if ret: | ||
| 42 | print " - Could not extract files." | ||
| 43 | else: | ||
| 44 | if req_files: | ||
| 45 | print " + Copy required files: %s" % ', '.join(req_files) | ||
| 46 | for filename in req_files: | ||
| 47 | ret = os.system('mv ./%s/%s ./' % ("%s-%s" % (name, version), filename)) | ||
| 48 | if ret: | ||
| 49 | print " - Could not copy required file." | ||
| 50 | else: | ||
| 51 | ret = os.system('rm -R %s' % ("%s-%s" % (name, version))) | ||
| 52 | if ret: | ||
| 53 | print " - Could not remove temp. folder." | ||
| 54 | else: | ||
| 55 | print " + Temporary folder removed." |
kofoo.py
(5 / 5)
|   | |||
| 296 | 296 | """On a private notice, often used by nickserv, chanserv and other bots.""" | |
| 297 | 297 | sender = event.source() | |
| 298 | 298 | target = event.target() | |
| 299 | sender_nick = irclib.nm_to_n(sender).lower() | ||
| 299 | if sender: | ||
| 300 | sender_nick = irclib.nm_to_n(sender).lower() | ||
| 301 | else: | ||
| 302 | sender_nick = "" | ||
| 300 | 303 | arg = event.arguments()[0] | |
| 301 | 304 | if sender_nick == "nickserv": | |
| 302 | 305 | res = re.match("STATUS (\S*) (\d)", arg) | |
| … | … | ||
| 315 | 315 | if user in self.on_user_id_do: | |
| 316 | 316 | del self.on_user_id_do[user] | |
| 317 | 317 | return | |
| 318 | #self.on_nickserv_notice(server, arg) | ||
| 319 | #elif sender_nick == "chanserv": | ||
| 320 | # self.on_chanserv_notice(server, arg) | ||
| 321 | if self.on_privnotice_do: | ||
| 318 | if sender_nick and self.on_privnotice_do: | ||
| 322 | 319 | for func in self.on_privnotice_do: | |
| 323 | 320 | if callable(func): | |
| 324 | 321 | func(self, server, sender, arg) |
setup.sh
(0 / 11)
|   | |||
| 1 | ### This file is part of KoFooBot. This file is not licensed and belongs to Public Domain. ### | ||
| 2 | |||
| 3 | #!/bin/sh | ||
| 4 | # download python-twitter 0.6 | ||
| 5 | wget http://python-twitter.googlecode.com/files/python-twitter-0.6.tar.gz | ||
| 6 | # exctract it | ||
| 7 | tar xzf ./python-twitter-0.6.tar | ||
| 8 | # move the only important file | ||
| 9 | mv ./python-twitter-0.6/twitter.py ./ | ||
| 10 | # cleanup | ||
| 11 | rm python-twitter-0.6 -R |

