~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to doc/developers/plugin-api.txt

(jelmer) Use the absolute_import feature everywhere in bzrlib,
 and add a source test to make sure it's used everywhere. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
See also
23
23
--------
24
24
 
25
 
 * `Bazaar Developer Documentation Catalog <index.html>`_.
26
 
 * <http://bazaar-vcs.org/WritingPlugins> wiki page with many more
27
 
   suggestions about particular APIs
 
25
 * `Bazaar Developer Documentation Catalog <../index.html>`_.
 
26
 * `Bazaar Plugins Guide <http://doc.bazaar.canonical.com/plugins/en/plugin-development.html>`_ for
 
27
   more suggestions about particular APIs.
28
28
 
29
29
 
30
30
Structure of a plugin
128
128
 
129
129
  # (look for a .hg directory)
130
130
  bzr_control_formats = {"Mercurial":{'.hg/': None}}
131
 
  
 
131
 
132
132
  # (look for a file called .svn/format with contents 4\n).
133
133
  bzr_control_formats = {"Subversion":{'.svn/format': '4\n'}}
134
134
 
137
137
-------
138
138
 
139
139
An example setup.py follows::
140
 
  
 
140
 
141
141
  #!/usr/bin/env python2.4
142
142
  from distutils.core import setup
143
 
  
 
143
 
144
144
  bzr_plugin_name = 'demo'
145
145
  bzr_commands = [
146
146
      'new-command',
147
147
      ]
148
 
  
 
148
 
149
149
  bzr_branch_formats = {
150
150
      "Branch label on disk\n":"demo branch",
151
151
      }
153
153
  bzr_control_formats = {"Subversion":{'.svn/format': '4\n'}}
154
154
 
155
155
  bzr_transports = ["hg+ssh://"]
156
 
  
 
156
 
157
157
  bzr_plugin_version = (1, 3, 0, 'dev', 0)
158
158
  bzr_minimum_version = (1, 0, 0)
159
 
  
 
159
 
160
160
  if __name__ == 'main':
161
161
      setup(name="Demo",
162
162
            version="1.3.0dev0",
186
186
short complete sentence summarizing the plugin.  The full docstring is
187
187
shown by ``bzr help PLUGIN_NAME``.
188
188
 
189
 
Remember that to be effective, the module docstring must be the first
190
 
statement in the file.  It may come after comments but it must be before
191
 
any import statements.
 
189
This is a user-visible docstring so should be prefixed with ``__doc__ =``
 
190
to ensure help works under ``python -OO`` with docstrings stripped.
192
191
 
193
192
API version
194
193
-----------
242
241
time other than register or override functions to be called later.
243
242
 
244
243
The plugin can import bzrlib and call any function.
245
 
Some interesting APIs are described in <http://bazaar-vcs.org/WritingPlugins>
 
244
Some interesting APIs are described in `Bazaar Plugins Guide <http://doc.bazaar.canonical.com/plugins/en/plugin-development.html>`_.
246
245
 
247
246
 
248
247
Publishing your plugin
255
254
   <https://launchpad.net/bzr-fastimport>
256
255
   and publish the branches or tarballs there
257
256
 
258
 
 * include the plugin in <http://bazaar-vcs.org/BzrPlugins>
 
257
 * include the plugin in <http://wiki.bazaar.canonical.com/BzrPlugins>
259
258
 
260
259
 * post about it to the ``bazaar-announce`` list at ``lists.canonical.com``
261
260