| 40 | == Metadata for Single-File Plugins |
| 41 | |
| 42 | Plugins are typically packaged using setuptools egg format, but Trac also supports single-file plugins. A single-file plugins is a single `.py` file that is placed in the project or shared `plugins` directory. While the metadata for a packaged plugin is stored in it's `setup.py` file, the metadata for a single-file plugin can added using file-scope attributes. The supported attributes and their aliases are: `author`, `author_email`, `home_page` (`url`), `license`, `trac` and `version` (`revision`). |
| 43 | |
| 44 | {{{#!python |
| 45 | revision = "$Rev$" |
| 46 | homepage = "http://trac-hacks.org/wiki/MyAmazingMacro" |
| 47 | license = "3-Clause BSD" |
| 48 | author = "Guido van Rossum" |
| 49 | author_email = "trac@python.org" |
| 50 | }}} |
| 51 | |
| 52 | The attributes should be self-explanatory with the possible exception of the `trac` attribute. The `trac` attribute is used to direct bug reports to an issue tracker that differs from `homepage`. If the plugin is hosted on trac-hacks.org and the `homepage` attribute is set to point to the project wiki page, the `trac` attribute will not need to be set. |
| 53 | |
| 54 | For files stored in Subversion, [http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html Keyword Substitution] is supported for the `homepage` (`url`) and `version` (`revision`) attributes. |
| 55 | |
| 56 | {{{#!python |
| 57 | homepage = '$URL$' |
| 58 | version = '$Rev$' |
| 59 | }}} |
| 60 | |
| 61 | {{{#!python |
| 62 | url = '$URL$' |
| 63 | revision = '$Rev$' |
| 64 | }}} |
| 65 | |
| 66 | The file's `svn:keywords` property must be edited to append `Rev` and/or `URL`. Note that the aliases `Revision`, `LastChangedRevision` and `HeadURL` are not supported. |
| 67 | {{{#!sh |
| 68 | svn propedit svn:keywords MyAmazingMacro.py |
| 69 | }}} |
| 70 | |
| 71 | Keep in mind that keywords are only expanded when the files are checked-out of version control. If the files are downloaded directly from a Trac repository or the repository is cloned using Git-SVN, then the keywords will not be expanded in the source. |
| 72 | |