3 ## This is www_post.py. This script is the main stage
4 ## of toplevel GNUmakefile local-WWW-post target.
6 # USAGE: www_post PACKAGE_NAME TOPLEVEL_VERSION BUILDSCRIPT-DIR OUTDIR TARGETS
7 # please call me from top of the source directory
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')
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' }
25 for f in static_files.keys():
26 open (f, 'w').write (static_files[f])
29 sys.path.append (buildscript_dir)
31 import add_html_footer
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,
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,
45 html_dict = add_html_footer.build_pages_dict (html_list)
46 strip_re = re.compile (outdir + '/')
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,
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))