Skip to content

Commit

Permalink
provide bundled change sources as plugins
Browse files Browse the repository at this point in the history
* this should help to "unify" the way changes sources are defined
  • Loading branch information
Mikhail Sobolev committed Aug 14, 2014
1 parent e2486e3 commit 8951622
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
2 changes: 1 addition & 1 deletion master/buildbot/interfaces.py
Expand Up @@ -50,7 +50,7 @@ class IPlugin(Interface):
"""


class IChangeSource(Interface):
class IChangeSource(IPlugin):

"""
Service which feeds Change objects to the changemaster. When files or
Expand Down
23 changes: 23 additions & 0 deletions master/buildbot/plugins/__init__.py
@@ -0,0 +1,23 @@
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright Buildbot Team Members

"""
Buildbot plugin infrastructure
"""

from buildbot.plugins.db import get_plugins
from buildbot.interfaces import IChangeSource

changes = get_plugins('change_source', IChangeSource)
43 changes: 43 additions & 0 deletions master/setup.py
Expand Up @@ -85,6 +85,33 @@ def make_release_tree(self, base_dir, files):
open(dst_fn, 'w').write(src)


def define_plugin_entry(name, module_name):
"""
helper to produce lines suitable for setup.py's entry_points
"""
if isinstance(name, tuple):
entry, name = name
else:
entry = name
return '%s = %s:%s' % (entry, module_name, name)


def define_plugin_entries(groups):
"""
helper to all groups for plugins
"""
result = dict()

for group, modules in groups:
tempo = []
for module_name, names in modules:
tempo.extend([define_plugin_entry(name, module_name)
for name in names])
result[group] = tempo

return result


long_description = """
The Buildbot is a system to automate the compile/test cycle required by
most software projects to validate code changes. By automatically
Expand Down Expand Up @@ -175,6 +202,22 @@ def make_release_tree(self, base_dir, files):
'scripts': scripts,
'cmdclass': {'install_data': install_data_twisted,
'sdist': our_sdist},
'entry_points': define_plugin_entries([
('buildbot.change_source', [
('buildbot.changes.mail', [
'MaildirSource', 'CVSMaildirSource',
'SVNCommitEmailMaildirSource',
'BzrLaunchpadEmailMaildirSource']),
('buildbot.changes.bitbucket', ['BitbucketPullrequestPoller']),
('buildbot.changes.bonsaipoller', ['BonsaiPoller']),
('buildbot.changes.gerritchangesource', ['GerritChangeSource']),
('buildbot.changes.gitpoller', ['GitPoller']),
('buildbot.changes.hgpoller', ['HgPoller']),
('buildbot.changes.p4poller', ['P4Source']),
('buildbot.changes.pb', ['PBChangeSource']),
('buildbot.changes.svnpoller', ['SVNPoller'])
])
])
}

# set zip_safe to false to force Windows installs to always unpack eggs
Expand Down

0 comments on commit 8951622

Please sign in to comment.