/[qa]/trunk/pts/www/bin/receive_news.py
ViewVC logotype

Contents of /trunk/pts/www/bin/receive_news.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1154 - (show annotations) (download) (as text)
Sun Nov 20 14:55:09 2005 UTC (7 years, 6 months ago) by jeroen
File MIME type: text/x-python
File size: 1398 byte(s)
- Fix encoding to utf8: non-ascii without encoding not allowed by Sarge's
  python
- Use default python (instead of 2.2) everywhere in the web part of the PTS
1 #!/usr/bin/python
2 # -*- coding: utf8 -*-
3
4 # Make sure tabs expand to 8 spaces in vim
5 # vim: expandtab
6
7 # Copyright 2002 Raphaƫl Hertzog
8 # This file is distributed under the terms of the General Public License
9 # version 2 or (at your option) any later version.
10
11 import os, os.path, sys, email, common
12
13 from config import dir, odir, root
14
15 os.umask(0002)
16 os.environ["PATH"] = "/bin:/sbin:/usr/bin:/usr/sbin"
17
18 msg = email.message_from_file(sys.stdin)
19
20 info = common.extract_info(msg)
21
22 subdir = "news"
23 nbmsg = 30
24 if info.has_key("static") or (len(sys.argv) >= 2 and sys.argv[1] == "static"):
25 subdir = "static"
26 nbmsg = 5
27
28 if info.has_key("package"):
29 pkg = info["package"]
30 hash = pkg[0]
31 if pkg[:3] == "lib": hash = pkg[:4]
32 srcdir = "%s/base/%s/%s" % (root, hash, pkg)
33 if not os.path.isdir(srcdir):
34 sys.exit("Invalid source package: %s" % pkg)
35 outdir = srcdir + "/" + subdir
36 htmldir = "%s/web/%s/%s/%s" % (root, hash, pkg, subdir)
37 common.save_msg_in_dir(msg, outdir, nbmsg)
38 common.generate_html_msg(outdir, htmldir, nbmsg)
39 # Synchronize the XML document
40 f = os.popen("%s/bin/update_news.py" % root, "w")
41 f.write(pkg+"\n")
42 f.close()
43 # Regenerate the HTML page
44 f = os.popen("%s/bin/generate_html.sh" % root, "w")
45 f.write(pkg+"\n")
46 f.close()
47 else:
48 sys.exit("The mail must have a 'Package: <srcpkg>' pseudo-header ...")
49

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5