]> git.donarmstrong.com Git - lilypond.git/blob - buildscripts/www_post.py
Merge branch 'master' of git://git.sv.gnu.org/lilypond
[lilypond.git] / buildscripts / www_post.py
1 #!@PYTHON@
2
3 ## This is www_post.py. This script is the main stage
4 ## of toplevel GNUmakefile local-WWW-post target.
5
6 # USAGE: www_post PACKAGE_NAME TOPLEVEL_VERSION BUILDSCRIPT-DIR OUTDIR TARGETS
7 # please call me from top of the source directory
8
9 import sys
10 import os
11 import re
12
13 package_name, package_version, buildscript_dir, outdir, targets = sys.argv[1:]
14 targets = targets.split (' ')
15 outdir = os.path.normpath (outdir)
16 doc_dirs = ['input', 'Documentation', outdir]
17 target_pattern = os.path.join (outdir, '%s-root')
18
19 static_files = {os.path.join (outdir, 'index.html'):
20                '''<META HTTP-EQUIV="refresh" content="0;URL=Documentation/index.html">
21 <html><body>Redirecting to the documentation index...</body></html>\n''',
22                os.path.join (outdir, 'VERSION'):
23                package_version + '\n' }
24
25 for f in static_files.keys():
26     open (f, 'w').write (static_files[f])
27
28
29 sys.path.append (buildscript_dir)
30 import mirrortree
31 import add_html_footer
32 import langdefs
33
34 sys.stderr.write ("Mirrorring...\n")
35 html_list = mirrortree.hardlink_tree (input_roots = doc_dirs,
36                           process_dirs = outdir,
37                           strip_dir_names = outdir,
38                           exclude_dirs = '(' +
39                                       '|'.join ([l.code for l in langdefs.LANGUAGES]) +
40                                       r'|po|out|\w*?-root)(/|$)',
41                           process_files = r'.*?\.(?:midi|pdf|png|txt|ly|signature)$|VERSION',
42                           exclude_files = r'lily-[0-9a-f]+.*\.pdf',
43                           target_pattern = target_pattern,
44                           targets = targets)
45 html_dict = add_html_footer.build_pages_dict (html_list)
46 strip_re = re.compile (outdir + '/')
47 for t in targets:
48     sys.stderr.write ("Processing HTML pages for %s target...\n" % t)
49     add_html_footer.add_html_footer (
50         package_name = package_name,
51         package_version = package_version,
52         target = t,
53         mail_address = 'http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs',
54         pages_dict = html_dict,
55         out_root = target_pattern % t,
56         name_filter = lambda s: strip_re.sub ('', s))