Package: pbp.recipe.trac
This recipe will help you setup a full-featured Trac instance via buildout.It allows you to automate the creation and management of multiples Trac
instances. It provides sensible default to thetrac.iniconfiguration file
and adds plugins to increase Trac features. This recipe also takes care of
instance upgrades, Wiki documentation updates and source code repository
synchronization.It currently supports Trac 0.12.x only, as for all future release ofpbp.recipe.tracv0.4.x.This package was originally part of theExpert Python Programmingbook written
by Tarek Ziadé.ContentsDetailed DocumentationSupported optionsExample usageSupportContributorsChange history0.4.3 (2011-01-27)0.4.2 (2010-12-22)0.4.1 (2010-12-01)0.4.0 (2010-11-04)0.3.0 (2010-10-08)0.2.3 (2010-04-24)0.1.0 (2008-06-16)DownloadDetailed DocumentationSupported optionsThe recipe supports the following options:project-name(required)Name of the Trac instance. This name will also be used as the default value
for thesmtp-from-nameoption. Default value:My project.project-descriptionDescription of the project. This description will also be used as the
alternative text to the header logo.project-urlThis URL will be used as the link on the header logo. Default value:http://example.com.repos(required)This parameter list all the code repositories managed by your Trac instance.
The syntax must respect the following scheme:Name | Type | Path | URL.
Name must be alphanumerical lower string. Supported values for types are:svnfor Subversion,hgfor Mercurial. Path must point to the location
of your code repository in the file system. The URL is not mandatory.
You can add several repositories, one per line. Example:repos = repo1 | svn | /data/svn/my_reposo                        | http://my-domain.net/subversion/repo1
        repo2 | svn | ${buildout:directory}/repos/another_reposo | svn://example.com/repo2
        repo3 | hg  | /data/hg/reposo2                           | https://user@stuff.com/projectdefault-repoIf set with a repository name, this will create an alias from the default
repository to the given repository. Example:default-repo = repo2repos-syncThis option deals with the way repositories are synchronized with Trac.Currently it only supportper-request synchronization. This is
the method that will be setup if you give this option therequestvalue.
This is the default value.In the future, this option will accepthookas a value, to setupexplicit
synchronization.This option only takes Subversion repositories into account.force-instance-upgradeIf set toTrue, this will trigger the internal Trac upgrade process on
the current instance, even if Trac don’t think it’s needed. Default value:False.force-repos-resyncIf set toTrue, this will force the resynchronization of Trac against all
the repositories. Default value:False.wiki-doc-upgradeIf set toTrue, this will upgrade the default wiki pages embedded in the
current Trac instance. As said in Trac documentation, thiswill not remove
deprecated wiki pagesthat were previously
part of a Trac release. Default value:False.remove-examplesIf set toFalse, this will not remove the default milestones and
components added by Trac when creating a brand new instance. Default value:True.milestonesList of all custom milestones to create. You can add several custom
parameters, one per line. Example:milestones = 0.1
             0.2
             1.0
             Future
             UndecidedcomponentsList of components for which we can attached Trac tickets to. The syntax must
follow theComponent name | Component ownerscheme, but components without
an owner are allowed. Example:components = The application itself | kevin
             Project web site
             Build tools            | cecilepermissionsList of custom permissions to set. Both users and groups are supported.
Example:permissions = cecile        | REPORT_ADMIN
              kevin         | PERMISSION_ADMIN MILESTONE_ADMIN REPORT_ADMIN
              anonymous     | STATS_VIEW
              authenticated | REPORT_MODIFY MILESTONE_MODIFYAlist of permissionscan
be found on Trac’s wiki. In respects to Trac’s conventions, all permissions
are automatically upper-cased by the recipe.header-logoLocation of the logo that will replace the default Trac logo at the top of
each page. The file will be copied by the recipe to thehtdocsdirectory
of your Trac instance.footer-messageThe bottom right-aligned text displayed on each page displayed by Trac. HTML
can be used here. Default valueThis Trac instance was generated by <ahref="http://pypi.python.org/pypi/pbp.recipe.trac">pbp.recipe.trac</a>..smtp-always-bccEmail address(es) to always send notifications to, addresses do not appear
publicly (Bcc:).smtp-always-ccEmail address(es) to always send notifications to, addresses can be seen by
all recipients (Cc:).smtp-default-domainDefault host/domain to append to address that do not specify onesmtp-enabledEnable SMTP (email) notification.smtp-fromSender address to use in notification emails.smtp-from-nameSender name to use in notification emails. Default value:project-nameoption value.smtp-passwordPassword for SMTP server.smtp-portSMTP server port to use for email notification.smtp-replytoReply-To address to use in notification emails.smtp-serverSMTP server hostname to use for email notifications.smtp-subject-prefixText to prepend to subject line of notification emails. If the setting is not
defined, then the value ofproject-nameis used as prefix. If no prefix
is desired,then specifying an empty option will disable it.smtp-userUsername for SMTP server.additional-menu-itemsThis will use theNavAdd pluginto add new menu entries in Trac’s top navigation toolbar. The syntax must
respect the following scheme:Title | Url. You can specify multiple menu
entries as shown in the following example:additional-menu-items = Buildbot      | http://localhost:9080/
                        Demo instance | http://trac.edgewall.org/demo-0.13time-tracking-pluginIf set toenabled, will activate theEstimation and Time Tracking plugin. Default value:disabled.stats-pluginIf set toenabled, will activate theTracStats plugin. Default value:disabled.trac-ini-additionalIn case a Trac parameter is not natively supported by this recipe, you can
use this to add your own. The syntax must respect the following scheme:Section | Parameter | Value. You can add several custom parameters, one
per line. Example:trac-ini-additional = attachment   | max_size            | 52428800
                      notification | always_notify_owner | true
                      logging      | log_level           | DEBUGThis option is applied just before writing the finaltrac.inigenerated by
this recipe. So thanks totrac-ini-additional, you always have a way to
fix yourtrac.inieven if this recipe breaks it.And to get more informations on all thetrac.iniparameters, see:http://trac.edgewall.org/wiki/TracIniExample usageWe’ll start by creating a buildout that uses the recipe:>>> write('buildout.cfg',
... """
... [buildout]
... parts = trac
... index = http://pypi.python.org/simple
...
... [trac]
... recipe = pbp.recipe.trac
... project-name = My project
... project-url = http://example.com
... repos = repo1 | hg | sqlite:${buildout:directory}/var/svn | http://my-domain.net/subversion/repo1
... default-repo = repo1
... header-logo = ${buildout:directory}/my_logo
... smtp-server = localhost
... smtp-port = 25
... smtp-from = tarek@ziade.org
... smtp-replyto = tarek@ziade.org
... milestones = 0.1
...              0.2
...              1.0
...              Future
...              Undecided
... components = The application itself | kevin
...              Project web site
...              Build tools            | cecile
... """)Let’s run the buildout:>>> res = system(buildout)This creates a trac instance:>>> ls(join(sample_buildout, 'parts', 'trac'))
-  README
-  VERSION
d  attachments
d  conf
d  db
d  htdocs
d  log
d  plugins
d  templatesWith a trac.ini file. Let’s check its content:>>> f = join(sample_buildout, 'parts', 'trac', 'conf', 'trac.ini')
>>> from ConfigParser import ConfigParser
>>> parser = ConfigParser()
>>> null = parser.read([f])
>>> parser.get('repositories', 'repo1.type')
'hg'
>>> parser.get('repositories', 'repo1.dir')
'/sample-buildout/var/svn'
>>> parser.get('project', 'descr')
'My example project'
>>> parser.get('project', 'name')
'My project'
>>> parser.get('project', 'url')
''
>>> parser.get('components', 'tracext.hg.*')
'enabled'Check the milestones:>>> from trac.admin.console import TracAdmin
>>> from trac.ticket.model import Milestone, Component
>>> location = join(sample_buildout, 'parts', 'trac')
>>> trac = TracAdmin(location)
>>> Milestone(trac.env, name='0.1')
<trac.ticket.model.Milestone object at ...
>>> Milestone(trac.env, name='Future')
<trac.ticket.model.Milestone object at ...
>>> Milestone(trac.env, name='milestone1')
Traceback (most recent call last):
...
ResourceNotFound: Milestone milestone1 does not exist.Check the components:>>> component = Component(trac.env, name='The application itself')
>>> component
<trac.ticket.model.Component object at ...
>>> component.owner
u'kevin'
>>> Component(trac.env, name='component1')
Traceback (most recent call last):
...
ResourceNotFound: Component component1 does not exist.SupportDocumentation:http://pypi.python.org/pypi/pbp.recipe.tracBug tracker:http://bitbucket.org/tarek/atomisator/issuesSource:http://bitbucket.org/tarek/atomisator/src/tip/packages/pbp.recipe.trac/Tutorial, example and how-to migrate from a legacy Trac instance:http://kevin.deldycke.com/2010/12/automate-trac-instance-deployment-buildout/Page about Buildout-based installation on Trac wiki:http://trac.edgewall.org/wiki/CookBook/TracBuildoutpbp.recipe.trac is a sub-project of Atomistor:http://atomisator.ziade.orgContributorsTarek Ziade, Author [tarek]Kevin Deldycke, Contributor [kdeldycke]Marco Scheidhuber, Contributor [j23d]Change history0.4.3 (2011-01-27)Fix all SMTP options.
[kdeldycke]0.4.2 (2010-12-22)Fix creation of milestones and components.
[j23d]0.4.1 (2010-12-01)Add an option to deals with repository synchronization.
[kdeldycke]0.4.0 (2010-11-04)Let’s make this release based on Trac 0.12.
[kdeldycke]Rework the milestones and components system to work with Trac 0.12.
[kdeldycke]Always transform permissions to upper strings.
[kdeldycke]Allow custom components to have no owner.
[kdeldycke]Let’s install the Babel package which add support of i18n to Trac.
[kdeldycke]Add initial support for multiple repositories.
[kdeldycke]Remove the TracSubversionLocation plugin as its features are now implemented
by Trac itself.
[kdeldycke]Add an option to set the default repository.
[kdeldycke]Apply custom permissions at the end of the instance creation to let a chance
to plugins to register their custom permissions.
[kdeldycke]0.3.0 (2010-10-08)Force upgrade of informations used during initialization: this is necessary
to keep these parameters fresh if the Trac project structure already exists.
[kdeldycke]Get the latest Trac 0.11.x but exclude the 0.12.x branch.
[kdeldycke]Document all supported options.
[kdeldycke]Add new options: project-description and footer-message.
[kdeldycke]Reuse the description as alternative text to the logo.
[kdeldycke]Add support for all SMTP parameters.
[kdeldycke]Add support for trac.ini custom parameters.
[kdeldycke]Auto-install Pygments to benefit syntax highlighting.
[kdeldycke]Use pytz to get nice and friendly timezones.
[kdeldycke]Bring docutils to add reStructuredText (rst) support in Trac’s wiki.
[kdeldycke]Add an option to let the user choose if default data added by Trac should be
removed or not.
[kdeldycke]Auto-upgrade Trac instance against latest scheme. Add an option to let user
force the upgrade.
[kdeldycke]Add an option to force upgrade of Wiki pages that are part of the
self-documentation embedded in the Trac instance.
[kdeldycke]Set default value of the smtp-from-name parameter.
[kdeldycke]Add an option to force resynchronization of Trac against the source code
repository.
[kdeldycke]Add an option to enable the time management plugin.
[kdeldycke]Replace buildbot-url parameter by a more generic additional-menu-items
option.
[kdeldycke]Allow the creation of multiple custom milestones.
[kdeldycke]Add support for TracStats plugin.
[kdeldycke]Add support for the Subversion location plugin.
[kdeldycke]Add an option to set custom permissions.
[kdeldycke]0.2.3 (2010-04-24)Fixed plugins svn paths.
[tarek]0.1.0 (2008-06-16)Created recipe with ZopeSkel.
[tarek]Download