diff options
author | pgollucci <pgollucci@FreeBSD.org> | 2010-10-12 14:21:13 +0800 |
---|---|---|
committer | pgollucci <pgollucci@FreeBSD.org> | 2010-10-12 14:21:13 +0800 |
commit | 9eafa833b9be9ccc9dd2e1fc13afa1837dd0071b (patch) | |
tree | 9cbc0001c688811cb43c10408307fa64440ec817 /www/trac-announcer | |
parent | 773bcd205ac2ab9e2d22d8069ae7b9e8b6e50783 (diff) | |
download | freebsd-ports-gnome-9eafa833b9be9ccc9dd2e1fc13afa1837dd0071b.tar.gz freebsd-ports-gnome-9eafa833b9be9ccc9dd2e1fc13afa1837dd0071b.tar.zst freebsd-ports-gnome-9eafa833b9be9ccc9dd2e1fc13afa1837dd0071b.zip |
The AnnouncerPlugin is meant to provide an extensible,
user-customizable notification system that can be used
to completely replace Trac's default notifications.
WWW: http://trac-hacks.org/wiki/AnnouncertPlugin
PR: ports/150484
Submitted by: Eygene Ryabinkin <rea-fbsd at codelabs.ru>
Diffstat (limited to 'www/trac-announcer')
-rw-r--r-- | www/trac-announcer/Makefile | 46 | ||||
-rw-r--r-- | www/trac-announcer/distinfo | 3 | ||||
-rw-r--r-- | www/trac-announcer/files/patch-mail-dont-encode-ascii-headers | 15 | ||||
-rw-r--r-- | www/trac-announcer/files/patch-old-ticket-link-style | 80 | ||||
-rw-r--r-- | www/trac-announcer/pkg-descr | 5 |
5 files changed, 149 insertions, 0 deletions
diff --git a/www/trac-announcer/Makefile b/www/trac-announcer/Makefile new file mode 100644 index 000000000000..4129929eae50 --- /dev/null +++ b/www/trac-announcer/Makefile @@ -0,0 +1,46 @@ +# New ports collection makefile for: trac-autocomplete +# Date created: December 23, 2009 +# Whom: Eygene Ryabinkin <rea-fbsd@codelabs.ru> +# +# $FreeBSD$ +# + +PORTNAME= announcer +PORTVERSION= 1.0 +CATEGORIES= www python +MASTER_SITES= http://dist.codelabs.ru/fbsd/ +PKGNAMEPREFIX= trac- +DISTNAME= announcerplugin-r${REL} + +MAINTAINER= rea-fbsd@codelabs.ru +COMMENT= A plugin for making user-customizable notifications + +BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}Babel>=0.9:${PORTSDIR}/devel/py-babel +RUN_DEPENDS+= trac>=0.11:${PORTSDIR}/www/trac + +USE_PYTHON= 2.5+ +USE_ZIP= yes +USE_PYDISTUTILS= yes +PYDISTUTILS_PKGNAME= AnnouncerPlugin +PYDISTUTILS_NOEGGINFO= yes + +WRKSRC= ${WRKDIR}/announcerplugin/trunk +REL= 8411 +EGG_VER= 0.12_p2.dev + +PLIST_SUB+= PORTVERSION=${PORTVERSION:S/.a/_a/} \ + PYTHONVERSION=${_PYTHON_VERSION} +PLIST_FILES+= %%PYTHON_SITELIBDIR%%/AnnouncerPlugin-${EGG_VER}-py%%PYTHONVERSION%%.egg + +# We must fix file permissions -- ZIP file have 0000 for every file. +# Directory permissions are fine (they aren't stored inside ZIP +# file), but we set them too -- just in case. +post-extract: + @${FIND} ${WRKSRC} -type f | ${XARGS} ${CHMOD} 644 + @${FIND} ${WRKSRC} -type d | ${XARGS} ${CHMOD} 755 + +# Build phase: create locale stuff +build: configure + cd ${WRKSRC} && ${PYTHON_CMD} setup.py compile_catalog + +.include <bsd.port.mk> diff --git a/www/trac-announcer/distinfo b/www/trac-announcer/distinfo new file mode 100644 index 000000000000..15660dc64c03 --- /dev/null +++ b/www/trac-announcer/distinfo @@ -0,0 +1,3 @@ +MD5 (announcerplugin-r8411.zip) = 9bce5288566802a5a85c85868876c19c +SHA256 (announcerplugin-r8411.zip) = d67bc92713733205babf0c3437910c7dc72424d73597913199808df14efefb27 +SIZE (announcerplugin-r8411.zip) = 121238 diff --git a/www/trac-announcer/files/patch-mail-dont-encode-ascii-headers b/www/trac-announcer/files/patch-mail-dont-encode-ascii-headers new file mode 100644 index 000000000000..93cdab2d03ca --- /dev/null +++ b/www/trac-announcer/files/patch-mail-dont-encode-ascii-headers @@ -0,0 +1,15 @@ +--- announcer/util/mail.py.orig 2010-09-10 21:05:17.000000000 +0400 ++++ announcer/util/mail.py 2010-09-10 21:07:34.000000000 +0400 +@@ -48,7 +48,11 @@ + def set_header(message, key, value, charset=None): + if not charset: + charset = message.get_charset() or 'ascii' +- value = Header(value, charset, MAXHEADERLEN-(len(key)+2)) ++ # Don't encode pure ASCII headers. ++ try: ++ value = Header(value, 'ascii', MAXHEADERLEN-(len(key)+2)) ++ except: ++ value = Header(value, charset, MAXHEADERLEN-(len(key)+2)) + if message.has_key(key): + message.replace_header(key, value) + else: diff --git a/www/trac-announcer/files/patch-old-ticket-link-style b/www/trac-announcer/files/patch-old-ticket-link-style new file mode 100644 index 000000000000..d856129a11f7 --- /dev/null +++ b/www/trac-announcer/files/patch-old-ticket-link-style @@ -0,0 +1,80 @@ +--- ./announcer/formatters/ticket.py.orig 2010-09-10 19:37:52.000000000 +0400 ++++ ./announcer/formatters/ticket.py 2010-09-10 21:03:38.000000000 +0400 +@@ -36,7 +36,7 @@ + from genshi.template import NewTextTemplate, MarkupTemplate + from genshi.template import TemplateLoader + +-from trac.config import Option, IntOption, ListOption ++from trac.config import Option, IntOption, ListOption, BoolOption + from trac.core import * + from trac.mimeview import Context + from trac.test import Mock, MockPerm +@@ -72,6 +72,11 @@ + 'owner, reporter, milestone, priority, severity', + doc="""Comma seperated list of fields to appear in tickets. + Use * to include all headers.""") ++ ++ ticket_link_with_comment = BoolOption('announcer', ++ 'ticket_link_with_comment', ++ 'false', ++ """Include last change anchor to the ticket URL.""") + + def styles(self, transport, realm): + if realm == "ticket": +@@ -89,6 +94,38 @@ + elif style == "text/html": + return self._format_html(event) + ++ def _ticket_link(self, ticket): ++ ticket_link = self.env.abs_href('ticket', ticket.id) ++ if self.ticket_link_with_comment == False: ++ return ticket_link ++ ++ cnum = self._ticket_last_comment(ticket) ++ if cnum != None: ++ ticket_link += "#comment:%s" % str(cnum) ++ ++ return ticket_link ++ ++ def _ticket_last_comment(self, ticket): ++ cnum = -1 ++ ++ for entry in ticket.get_changelog(): ++ (time, author, field, oldvalue, newvalue, permanent) = entry ++ if field != "comment": ++ continue ++ ++ try: ++ n = int(oldvalue) ++ except: ++ continue ++ ++ if cnum < n: ++ cnum = n ++ ++ if cnum == -1: ++ return None ++ else: ++ return cnum ++ + def _format_plaintext(self, event): + ticket = event.target + short_changes = {} +@@ -109,7 +146,7 @@ + comment = event.comment, + fields = self._header_fields(ticket), + category = event.category, +- ticket_link = self.env.abs_href('ticket', ticket.id), ++ ticket_link = self._ticket_link(ticket), + project_name = self.env.project_name, + project_desc = self.env.project_description, + project_link = self.env.project_url or self.env.abs_href(), +@@ -189,7 +226,7 @@ + fields = self._header_fields(ticket), + comment = temp, + category = event.category, +- ticket_link = self.env.abs_href('ticket', ticket.id), ++ ticket_link = self._ticket_link(ticket), + project_name = self.env.project_name, + project_desc = self.env.project_description, + project_link = self.env.project_url or self.env.abs_href(), diff --git a/www/trac-announcer/pkg-descr b/www/trac-announcer/pkg-descr new file mode 100644 index 000000000000..325d9c29da19 --- /dev/null +++ b/www/trac-announcer/pkg-descr @@ -0,0 +1,5 @@ +The AnnouncerPlugin is meant to provide an extensible, +user-customizable notification system that can be used +to completely replace Trac's default notifications. + +WWW: http://trac-hacks.org/wiki/AnnouncertPlugin |