]> git.donarmstrong.com Git - lilypond.git/blobdiff - buildscripts/www_post.py
Fix 417.
[lilypond.git] / buildscripts / www_post.py
index cc38c392be222f499df629bc3a1d4ebe0a3e5584..8d7899ef0ebf7de524234f0c27d235919101d5e7 100644 (file)
@@ -11,24 +11,28 @@ import os
 import re
 import gettext
 
-package_name, package_version, buildscript_dir, outdir, targets = sys.argv[1:]
+package_name, package_version, buildscript_dir, localedir, outdir, targets = sys.argv[1:]
 targets = targets.split (' ')
 outdir = os.path.normpath (outdir)
 doc_dirs = ['input', 'Documentation', outdir]
 target_pattern = os.path.join (outdir, '%s-root')
 
 static_files = {
-    # ugly hack: the following overwrites HTML Info dir with a link to
-    # the (more useful) documentation index
-    os.path.join ('Documentation/user', outdir, 'index.html'):
-    '''<META HTTP-EQUIV="refresh" content="0;URL=../index.html">
-<html><body>Redirecting to the documentation index...</body></html>\n''',
     os.path.join (outdir, 'index.html'):
     '''<META HTTP-EQUIV="refresh" content="0;URL=Documentation/index.html">
 <html><body>Redirecting to the documentation index...</body></html>\n''',
     os.path.join (outdir, 'VERSION'):
     package_version + '\n' }
 
+import langdefs
+
+# ugly hack: the following overwrites HTML Info dir with a link to
+# the (more useful) documentation index
+for l in langdefs.LANGUAGES:
+    static_files[os.path.join ('Documentation/user', outdir, l.file_name ('index', '.html'))] = \
+                                  '<META HTTP-EQUIV="refresh" content="0;URL=../' + l.file_name ('index', '.html') + \
+                                  '">\n<html><body>Redirecting to the documentation index...</body></html>\n'
+
 for f, contents in static_files.items ():
     open (f, 'w').write (contents)
 
@@ -36,13 +40,12 @@ for f, contents in static_files.items ():
 sys.path.append (buildscript_dir)
 import mirrortree
 import add_html_footer
-import langdefs
 
 sys.stderr.write ("Mirrorring...\n")
 dirs, symlinks, files = mirrortree.walk_tree (
     tree_roots = doc_dirs,
     process_dirs = outdir,
-    exclude_dirs = '(' + '|'.join ([l.code for l in langdefs.LANGUAGES]) + r'|po|out|\w*?-root)(/|$)',
+    exclude_dirs = '(^|/)(' + '|'.join ([l.code for l in langdefs.LANGUAGES]) + r'|po|out|\w*?-root)(/|$)',
     find_files = r'.*?\.(?:midi|html|pdf|png|txt|ly|signature)$|VERSION',
     exclude_files = r'lily-[0-9a-f]+.*\.pdf')
 
@@ -57,7 +60,7 @@ for f in files:
 dirs = [re.sub ('/' + outdir, '', d) for d in dirs]
 while outdir in dirs:
     dirs.remove (outdir)
-dirs = listset (dirs))
+dirs = list (set (dirs))
 dirs.sort ()
 
 strip_file_name = {}
@@ -81,13 +84,9 @@ if 'online' in targets:
 
 # load gettext messages catalogs
 translation = {}
-localedir = os.path.join (buildscript_dir, '../Documentation/po', outdir)
 for l in langdefs.LANGUAGES:
     if l.enabled and l.code != 'en':
-        try:
-            translation[l.code] = gettext.translation('lilypond-doc', localedir, [l.code]).gettext
-        except:
-            translation[l.code] = lambda s: s
+        translation[l.code] = gettext.translation('lilypond-doc', localedir, [l.code]).gettext
 
 add_html_footer.build_pages_dict (html_files)
 for t in targets: