Skip to content

Instantly share code, notes, and snippets.

@evandrix
Created July 22, 2011 15:05
Show Gist options
  • Save evandrix/1099628 to your computer and use it in GitHub Desktop.
Save evandrix/1099628 to your computer and use it in GitHub Desktop.
TracPlugin: Minimal implementation
from logplugin import *
+-plugin-log/
|
+-logpackage/
| |
| +-__init__.py
| |
| +-logplugin.py
|
+-setup.py
from trac.core import implements, Component
from trac.env import IEnvironmentSetupParticipant
class SampleEnvironmentSetupParticipant(Component):
implements(IEnvironmentSetupParticipant)
# IEnvironmentSetupParticipant methods
def environment_created(self):
self.log.debug("creating environment for sample plugin.")
pass
def environment_needs_upgrade(self, db):
self.log.debug("the existing environment requires an upgrade for sample plugin.")
return True
def upgrade_environment(self, db):
self.log.debug("upgrading existing environment for sample plugin.")
pass
from setuptools import find_packages, setup
setup(
name='TracLog', version='1.0',
packages=find_packages(exclude=['*.tests']),
entry_points = {
'trac.plugins': [
'logplugin = logpackage.logplugin',
],
},
)
@evandrix
Copy link
Author

setup.py: add the following lines if additional resource data needs to be included with package

...
    package_data = {
        'helloworld': [
            'templates/*.html', 
            'htdocs/css/*.css', 
            'htdocs/images/*'
        ]
    },
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment