diff options
author | Mike Crute <mcrute@gmail.com> | 2015-05-18 20:30:58 -0700 |
---|---|---|
committer | Mike Crute <mcrute@gmail.com> | 2015-05-18 20:30:58 -0700 |
commit | 99f17d002054d6485100eb472aa90a7841162b1e (patch) | |
tree | 3206b8ca92fba215ed8bd057b9070852b2e02b40 | |
download | moin_setuptools_plugins-99f17d002054d6485100eb472aa90a7841162b1e.tar.bz2 moin_setuptools_plugins-99f17d002054d6485100eb472aa90a7841162b1e.tar.xz moin_setuptools_plugins-99f17d002054d6485100eb472aa90a7841162b1e.zip |
Initial import
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | README.txt | 24 | ||||
-rw-r--r-- | moin_setuptools_loader/__init__.py | 25 | ||||
-rw-r--r-- | setup.py | 10 |
4 files changed, 62 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0b116e4 --- /dev/null +++ b/.gitignore | |||
@@ -0,0 +1,3 @@ | |||
1 | /*.egg-info | ||
2 | *.pyc | ||
3 | .DS_Store | ||
diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..3c3c04b --- /dev/null +++ b/README.txt | |||
@@ -0,0 +1,24 @@ | |||
1 | Example entry point config :: | ||
2 | |||
3 | entry_points={ | ||
4 | "moin.plugins.action": [ | ||
5 | ], | ||
6 | "moin.plugins.converter": [ | ||
7 | ], | ||
8 | "moin.plugins.events": [ | ||
9 | ], | ||
10 | "moin.plugins.filter": [ | ||
11 | ], | ||
12 | "moin.plugins.formatter": [ | ||
13 | ], | ||
14 | "moin.plugins.macro": [ | ||
15 | ], | ||
16 | "moin.plugins.parser": [ | ||
17 | ], | ||
18 | "moin.plugins.theme": [ | ||
19 | ], | ||
20 | "moin.plugins.userprefs": [ | ||
21 | ], | ||
22 | "moin.plugins.xmlrpc": [ | ||
23 | ], | ||
24 | } | ||
diff --git a/moin_setuptools_loader/__init__.py b/moin_setuptools_loader/__init__.py new file mode 100644 index 0000000..c45e062 --- /dev/null +++ b/moin_setuptools_loader/__init__.py | |||
@@ -0,0 +1,25 @@ | |||
1 | import pkg_resources | ||
2 | from MoinMoin import wikiutil | ||
3 | from MoinMoin.config import multiconfig | ||
4 | |||
5 | |||
6 | class SetuptoolsPluginLoader(multiconfig.DefaultConfig): | ||
7 | |||
8 | _plugin_types = [ | ||
9 | "action", "converter", "events", "filter", "formatter", | ||
10 | "macro", "parser", "theme", "userprefs", "xmlrpc"] | ||
11 | |||
12 | def __init__(self, siteid): | ||
13 | super(SetuptoolsPluginLoader, self).__init__(siteid) | ||
14 | |||
15 | for kind in self._plugin_types: | ||
16 | wikiutil.wikiPlugins(kind, self) | ||
17 | self._load_setuptools_plugins(kind) | ||
18 | |||
19 | def _load_setuptools_plugins(self, kind): | ||
20 | entry_key = "moin.plugins.{}".format(kind) | ||
21 | |||
22 | for point in pkg_resources.iter_entry_points(entry_key): | ||
23 | point.load() | ||
24 | trimmed_name = ".".join(point.module_name.split(".")[:-1]) | ||
25 | self._site_plugin_lists[kind][point.name] = trimmed_name | ||
diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..7b7c36c --- /dev/null +++ b/setup.py | |||
@@ -0,0 +1,10 @@ | |||
1 | from setuptools import setup, find_packages | ||
2 | |||
3 | setup( | ||
4 | name="CruteMoinSetuptoolsPluginLoader", | ||
5 | version="1.0", | ||
6 | description="", | ||
7 | author="Michael Crute <mcrute@gmail.com>", | ||
8 | license="MIT", | ||
9 | packages=find_packages(), | ||
10 | ) | ||