Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Reorganize into proper packages.

  • Loading branch information...
commit 36c27a7965de5da592eea8157fc2732c5b3d4a6b 1 parent ec4bdcd
Neil Williams authored
4 harold.tac
View
@@ -1,7 +1,7 @@
from twisted.application import service
-from conf import HaroldConfiguration
-import plugin
+from harold.conf import HaroldConfiguration
+from harold import plugin
# read configuration
config = HaroldConfiguration("harold.ini")
0  harold/__init__.py
View
No changes.
3  conf.py → harold/conf.py
View
@@ -27,7 +27,8 @@ def tup(option):
class PluginConfig(object):
def __init__(self, config, section=None):
if not section:
- section = plugin_prefix + self.__module__
+ plugin_name = self.__module__[len("harold.plugins."):]
+ section = plugin_prefix + plugin_name
for name, contents in vars(type(self)).iteritems():
if not isinstance(contents, Option):
0  dispatcher.py → harold/dispatcher.py
View
File renamed without changes
7 plugin.py → harold/plugin.py
View
@@ -1,9 +1,7 @@
-import imp
+import importlib
import copy
import inspect
-PLUGIN_DIRECTORY = '.'
-
class Plugin(object):
def __init__(self):
self.services = []
@@ -16,8 +14,7 @@ def _import_plugin_modules(config):
plugins = {}
dependencies = {}
for plugin_name in config.plugin_names():
- file, pathname, description = imp.find_module(plugin_name, ['.'])
- plugin = imp.load_module(plugin_name, file, pathname, description)
+ plugin = importlib.import_module("harold.plugins." + plugin_name)
plugins[plugin_name] = plugin
args, varargs, kw, defaults = inspect.getargspec(plugin.make_plugin)
0  harold/plugins/__init__.py
View
No changes.
2  alarms.py → harold/plugins/alarms.py
View
@@ -3,7 +3,7 @@
from twisted.internet import reactor
-from conf import PluginConfig, Option
+from harold.conf import PluginConfig, Option
ALARM_PREFIX = 'harold:alarm:'
8 alerts.py → harold/plugins/alerts.py
View
@@ -4,10 +4,10 @@
from twisted.internet import reactor
-from http import ProtectedResource
-from conf import PluginConfig, Option, tup
-from utils import pretty_time_span
-import watchdog
+from harold.plugins.http import ProtectedResource
+from harold.conf import PluginConfig, Option, tup
+from harold.utils import pretty_time_span
+from harold.plugins import watchdog
def make_short_name(jid):
6 deploy.py → harold/plugins/deploy.py
View
@@ -4,9 +4,9 @@
from twisted.web import resource
from twisted.internet import reactor
-from http import ProtectedResource
-from conf import PluginConfig, Option
-from utils import pretty_and_accurate_time_span
+from harold.plugins.http import ProtectedResource
+from harold.conf import PluginConfig, Option
+from harold.utils import pretty_and_accurate_time_span
class DeployConfig(PluginConfig):
4 http.py → harold/plugins/http.py
View
@@ -1,8 +1,8 @@
from twisted.web import resource, server
from twisted.application import internet
-from plugin import Plugin
-from conf import PluginConfig, Option
+from harold.plugin import Plugin
+from harold.conf import PluginConfig, Option
class HttpConfig(PluginConfig):
port = Option(int, default=80)
4 ident.py → harold/plugins/ident.py
View
@@ -2,8 +2,8 @@
from twisted.application import internet
from twisted.internet.protocol import Factory
-from plugin import Plugin
-from conf import PluginConfig, Option
+from harold.plugin import Plugin
+from harold.conf import PluginConfig, Option
class IdentConfig(PluginConfig):
user = Option(str, default="harold")
10 irc.py → harold/plugins/irc.py
View
@@ -9,11 +9,11 @@
from twisted.application import internet
from twisted.web import resource
-from dispatcher import Dispatcher
-from http import ProtectedResource
-from plugin import Plugin
-from conf import PluginConfig, Option, tup
-from utils import Event
+from harold.dispatcher import Dispatcher
+from harold.plugins.http import ProtectedResource
+from harold.plugin import Plugin
+from harold.conf import PluginConfig, Option, tup
+from harold.utils import Event
class IrcConfig(PluginConfig):
4 jabber.py → harold/plugins/jabber.py
View
@@ -7,8 +7,8 @@
from twisted.words.protocols.jabber import xmlstream, client, jid
from twisted.application import internet
-from conf import PluginConfig, Option
-from plugin import Plugin
+from harold.conf import PluginConfig, Option
+from harold.plugin import Plugin
class JabberConfig(PluginConfig):
host = Option(str)
6 postreceive.py → harold/plugins/postreceive.py
View
@@ -1,8 +1,8 @@
import json
-from http import ProtectedResource
-from shorturl import UrlShortener
-from conf import PluginConfig, Option, tup
+from harold.plugins.http import ProtectedResource
+from harold.shorturl import UrlShortener
+from harold.conf import PluginConfig, Option, tup
REPOSITORY_PREFIX = 'harold:repository:'
4 smtp.py → harold/plugins/smtp.py
View
@@ -4,8 +4,8 @@
from twisted.internet.defer import Deferred
from twisted.mail import smtp
-from plugin import Plugin
-from conf import PluginConfig, Option
+from harold.plugin import Plugin
+from harold.conf import PluginConfig, Option
class SmtpConfig(PluginConfig):
4 watchdog.py → harold/plugins/watchdog.py
View
@@ -2,8 +2,8 @@
from twisted.internet import reactor
-from http import ProtectedResource
-from utils import pretty_time_span
+from harold.plugins.http import ProtectedResource
+from harold.utils import pretty_time_span
class WatchdogResource(ProtectedResource):
0  shorturl.py → harold/shorturl.py
View
File renamed without changes
0  utils.py → harold/utils.py
View
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.