Merge lp:~stefanor/ibid/external-modules-501728 into lp:~ibid-core/ibid/old-trunk-1.6

Proposed by Stefano Rivera
Status: Superseded
Proposed branch: lp:~stefanor/ibid/external-modules-501728
Merge into: lp:~ibid-core/ibid/old-trunk-1.6
Diff against target: 96 lines (+14/-1)
6 files modified
ibid/__init__.py (+1/-0)
ibid/core.py (+2/-0)
ibid/plugins/__init__.py (+3/-0)
scripts/ibid-db (+3/-1)
scripts/ibid-plugin (+3/-0)
scripts/ibid-setup (+2/-0)
To merge this branch: bzr merge lp:~stefanor/ibid/external-modules-501728
Reviewer Review Type Date Requested Status
Michael Gorven Needs Fixing
Review via email: mp+16733@code.launchpad.net

This proposal has been superseded by a proposal from 2010-01-02.

To post a comment you must log in.
Revision history for this message
Michael Gorven (mgorven) wrote :

> +sys.path.insert(1, '.')

Ibid won't necessarily be started in the botdir -- options['base'] contains
the directory based on the location of the config file.

 review needs_fixing

review: Needs Fixing
817. By Stefano Rivera

Use base instead of .

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ibid/__init__.py'
2--- ibid/__init__.py 2010-01-02 10:07:14 +0000
3+++ ibid/__init__.py 2010-01-02 16:04:11 +0000
4@@ -49,6 +49,7 @@
5 for key, value in opts.items():
6 options[key] = value
7 options['base'] = dirname(options['config'])
8+ sys.path.insert(0, options['base'])
9
10 # Get Twisted to log to Python logging
11 twisted.python.log.startLoggingWithObserver(twisted_log)
12
13=== modified file 'ibid/core.py'
14--- ibid/core.py 2009-12-30 22:01:38 +0000
15+++ ibid/core.py 2010-01-02 16:04:11 +0000
16@@ -180,6 +180,8 @@
17 noload = List of plugins / plugin.Processors to skip automatically loading
18 autoload = (Boolean) Load all plugins by default?
19 """
20+ # Sets up twisted.python so that we can iterate modules
21+ __import__('ibid.plugins')
22
23 load = 'load' in ibid.config.plugins and ibid.config.plugins['load'] or []
24 noload = 'noload' in ibid.config.plugins and ibid.config.plugins['noload'] or []
25
26=== modified file 'ibid/plugins/__init__.py'
27--- ibid/plugins/__init__.py 2009-12-14 13:43:58 +0000
28+++ ibid/plugins/__init__.py 2010-01-02 16:04:11 +0000
29@@ -5,11 +5,14 @@
30 import re
31
32 from twisted.spread import pb
33+from twisted.plugin import pluginPackagePaths
34 from twisted.web import resource
35
36 import ibid
37 from ibid.compat import json
38
39+__path__.extend(pluginPackagePaths(__name__))
40+
41 class Processor(object):
42 """Base class for Ibid plugins.
43 Processors receive events and (optionally) do things with them.
44
45=== modified file 'scripts/ibid-db'
46--- scripts/ibid-db 2009-12-20 20:17:17 +0000
47+++ scripts/ibid-db 2010-01-02 16:04:11 +0000
48@@ -5,11 +5,13 @@
49 import logging
50 from optparse import OptionParser, OptionGroup
51 from os.path import exists
52-from sys import stdin, stdout, stderr, exit
53+from sys import path, stdin, stdout, stderr, exit
54
55 from sqlalchemy import select, DateTime
56 from twisted.python.modules import getModule
57
58+path.insert(0, '.')
59+
60 import ibid
61 from ibid.compat import json
62 from ibid.config import FileConfig
63
64=== modified file 'scripts/ibid-plugin'
65--- scripts/ibid-plugin 2009-12-30 22:01:38 +0000
66+++ scripts/ibid-plugin 2010-01-02 16:04:11 +0000
67@@ -4,6 +4,7 @@
68 from optparse import OptionParser
69 from os import getenv
70 from os.path import exists
71+import sys
72
73 try:
74 import readline
75@@ -14,6 +15,8 @@
76
77 from sqlalchemy.exceptions import IntegrityError
78
79+sys.path.insert(0, '.')
80+
81 import ibid
82 import ibid.plugins
83 from ibid.config import FileConfig
84
85=== modified file 'scripts/ibid-setup'
86--- scripts/ibid-setup 2009-12-20 20:17:17 +0000
87+++ scripts/ibid-setup 2010-01-02 16:04:11 +0000
88@@ -12,6 +12,8 @@
89 from pkg_resources import resource_stream
90 from twisted.python.modules import getModule
91
92+sys.path.insert(0, '.')
93+
94 import ibid
95 from ibid.config import FileConfig
96 from ibid.core import DatabaseManager

Subscribers

People subscribed via source and target branches