annotate contrib/sawmill/bin/generate-rss.py @ 520:5802cec2b071

fixed typo
author Bjoern Ricks <bricks@intevation.de>
date Wed, 10 Nov 2010 16:46:12 +0000
parents 93d66243bce7
children
rev   line source
492
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
1 #!/usr/bin/env python
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
2 # -*- coding: UTF-8 -*-
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
3 #
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
4 # Copyright (C) 2010 by Intevation GmbH
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
5 # Authors:
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
6 # Sascha L. Teichmann <sascha.teichmann@intevation.de>
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
7 #
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
8 # This program is free software under the GPL (>=v2)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
9 # Read the file COPYING coming with the software for details.
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
10
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
11 import sys
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
12 import os
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
13 import re
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
14 import traceback
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
15
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
16 from datetime import datetime
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
17
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
18 from lxml import etree
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
19
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
20 import PyRSS2Gen as RSS2
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
21
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
22 BASE_URL = "http://saegewerk2.wald.intevation.org/buildlogs"
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
23 LINK_URL = "%s/details.py?treepkg=%%s" % BASE_URL
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
24 ITEM_URL = "%s/details.py?treepkg=%%s#%%s" % BASE_URL
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
25
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
26 TITLE = "Saegewerk - %s"
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
27 DESCRIPTION = "Build errors of '%s'"
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
28 MESSAGE = "%s: error building %s rev. %s"
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
29 TTL = 7
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
30
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
31 START = re.compile(
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
32 r"start:\s+(\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2}):(\d{2})")
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
33 STATUS = re.compile(r"status:\s+(.+)")
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
34
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
35 INVALID_LABEL = re.compile(r"[^a-zA-Z0-9_]")
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
36
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
37 def make_valid_label(l):
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
38 return INVALID_LABEL.sub("_", l)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
39
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
40 def to_datetime(m):
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
41 m = map(int, m.groups())
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
42 return datetime(
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
43 year=m[0], month=m[1], day=m[2],
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
44 hour=m[3], minute=m[4], second=m[5])
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
45
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
46 def usage(msg, code=1):
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
47 print >> sys.stderr, "%s <treepkgs directory>" % sys.argv[0]
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
48 print >> sys.stderr, "%s" % msg
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
49 sys.exit(code)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
50
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
51 def main():
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
52 if len(sys.argv) < 2:
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
53 usage("missing treepkgs directory")
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
54
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
55 treepkgs_dir = sys.argv[1]
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
56 if not os.path.isdir(treepkgs_dir):
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
57 usage("'%s' is not a directory" % treepkgs_dir)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
58
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
59 for treepkg in os.listdir(treepkgs_dir):
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
60 treepkg_dir = os.path.join(treepkgs_dir, treepkg)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
61 if not os.path.isdir(treepkg_dir): continue
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
62 treepkg_xml = os.path.join(treepkg_dir, "treepkg.xml")
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
63 if not os.path.isfile(treepkg_xml): continue
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
64 try:
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
65 f = open(treepkg_xml, "rb")
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
66 try: treepkg_dom = etree.parse(f)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
67 finally: f.close()
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
68 except:
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
69 traceback.print_exc(file=sys.stderr)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
70 continue
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
71 description = ''.join(
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
72 treepkg_dom.xpath('/treepkg/description/text()'))
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
73
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
74 tracks_dir = os.path.join(treepkg_dir, "tracks")
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
75 if not os.path.isdir(tracks_dir): continue
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
76
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
77 items = []
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
78
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
79 for track in os.listdir(tracks_dir):
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
80 track_dir = os.path.join(tracks_dir, track, "pkg")
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
81 if not os.path.isdir(track_dir): continue
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
82
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
83 track_label = make_valid_label(track)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
84
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
85 for revision in os.listdir(track_dir):
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
86 revision_dir = os.path.join(track_dir, revision)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
87 if not os.path.isdir(revision_dir): continue
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
88 status_file = os.path.join(revision_dir, "status")
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
89 if not os.path.isfile(status_file): continue
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
90 start, status = None, None
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
91 try:
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
92 f = open(status_file, "r")
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
93 try:
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
94 while True:
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
95 line = f.readline()
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
96 if not line: break
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
97 m = STATUS.match(line)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
98 if m: status = m.group(1); continue
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
99 m = START.match(line)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
100 if m: start = to_datetime(m)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
101 finally:
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
102 f.close()
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
103 except:
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
104 traceback.print_exc(file=sys.stderr)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
105 continue
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
106 if status != "error" or not start: continue
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
107
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
108 label = ''.join([
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
109 track_label,
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
110 make_valid_label(revision),
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
111 start.strftime("%Y%m%d%H%M%S")])
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
112
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
113 link = ITEM_URL % (treepkg, label)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
114 msg = MESSAGE % (description, track, revision)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
115 item = RSS2.RSSItem(
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
116 title = msg,
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
117 link = link,
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
118 description = msg,
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
119 guid = RSS2.Guid(link, isPermaLink=0),
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
120 pubDate = start
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
121 )
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
122 items.append(item)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
123
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
124 items.sort(key=lambda x: x.pubDate)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
125
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
126 rss = RSS2.RSS2(
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
127 title = TITLE % description,
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
128 link = LINK_URL % treepkg,
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
129 description = DESCRIPTION % description,
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
130 pubDate = datetime.utcnow(),
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
131 ttl = TTL,
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
132 items = items)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
133
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
134 pid, idx = os.getpid(), 0
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
135 while True:
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
136 tmp_f = os.path.join(
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
137 treepkg_dir, "rss.xml.tmp%d-%d" % (pid, idx))
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
138 if not os.path.exists(tmp_f): break
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
139 idx += 1
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
140
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
141 try:
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
142 f = open(tmp_f, "wb")
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
143 try: rss.write_xml(f, encoding="UTF-8")
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
144 finally: f.close()
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
145
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
146 rss_xml = os.path.join(treepkg_dir, "rss.xml")
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
147
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
148 os.rename(tmp_f, rss_xml)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
149 except:
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
150 traceback.print_exc(file=sys.stderr)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
151 if os.path.exists(tmp_f):
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
152 try: os.remove(tmp_f)
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
153 except: pass
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
154
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
155 if __name__ == '__main__':
93d66243bce7 sawmill: Added RSS feed generator.
Sascha Teichmann <teichmann@intevation.de>
parents:
diff changeset
156 main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)