]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/build/www_post.py
Add '-dcrop' option to ps and svg backends
[lilypond.git] / scripts / build / www_post.py
index 29f80cf09fa2bb208995e7c5094974782c6ee566..a421369a723f7022ccecde4c234dabeff65fcfcf 100644 (file)
@@ -25,37 +25,53 @@ target_pattern = os.path.join (outdir, '%s-root')
 # from HTML manuals/snippets page
 static_files = {
     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''',
+        '''<META HTTP-EQUIV="refresh" content="0;URL=Documentation/web/index.html">
+<html>
+<head>
+<title>Redirecting...</title>
+<meta name="author" content="This file was autogenerated by %s">
+</head>
+<body>Redirecting to the documentation index...</body>
+</html>
+''' % sys.argv[0],
     os.path.join (outdir, 'VERSION'):
         package_version + '\n',
-    os.path.join ('input', 'lsr', outdir, 'index.html'):
-        '''<META HTTP-EQUIV="refresh" content="0;URL=../../index.html">
-<html><body>Redirecting to the documentation index...</body></html>\n'''
     }
 
-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)
 
-sys.stderr.write ("Mirrorring...\n")
+sys.stderr.write ("Mirroring...\n")
 dirs, symlinks, files = mirrortree.walk_tree (
     tree_roots = doc_dirs,
     process_dirs = outdir,
-    exclude_dirs = '(^|/)(' + r'|po|out|out-test|.*?[.]t2d|\w*?-root)(/|$)|Documentation/(' + '|'.join ([l.code for l in langdefs.LANGUAGES]) + ')',
-    find_files = r'.*?\.(?:midi|html|pdf|png|txt|i?ly|signature|css)$|VERSION',
+    exclude_dirs = '(^|/)((' + \
+        r'po|xref-maps|out|out-test|out-cov|.*?[.]t2d|\w*?-root)|^Documentation/(' + \
+        '|'.join ([l.code for l in langdefs.LANGUAGES]) + '))(/|$)',
+    find_files = r'.*?\.(?:midi|html|pdf|png|jpe?g|txt|i?ly|signature|css|zip|js|..\.idx|php)$|VERSION',
     exclude_files = r'lily-[0-9a-f]+.*\.(pdf|txt)')
+# extra files: info and tex output from lilypond-book regtests
+extra_files = mirrortree.walk_tree (
+    tree_roots = ['input/regression/lilypond-book'],
+    process_dirs = outdir,
+    exclude_dirs = r'(^|/)(out|out-test)(/|$)',
+    find_files = r'.+\.(info|tex)$',
+    exclude_files = r'lily-[0-9a-f]+.*\.tex')[2]
+files.extend(extra_files)
 
 # actual mirrorring stuff
 html_files = []
 hardlinked_files = []
+# These whitelisted files actually do contain the string
+# 'UNTRANSLATED NODE: IGNORE ME' for documentation purposes.
+whitelisted_files = [
+    'Documentation/out-www/contributor-big-page.html',
+    'Documentation/out-www/contributor/website-build.html',
+]
 for f in files:
     if f.endswith ('.html'):
-        html_files.append (f)
+        if f in whitelisted_files or not 'UNTRANSLATED NODE: IGNORE ME' in open (f).read ():
+            html_files.append (f)
     else:
         hardlinked_files.append (f)
 dirs = [re.sub ('/' + outdir, '', d) for d in dirs]
@@ -69,19 +85,21 @@ strip_re = re.compile (outdir + '/')
 for t in targets:
     out_root = target_pattern % t
     strip_file_name[t] = lambda s: os.path.join (target_pattern % t, (strip_re.sub ('', s)))
-    os.mkdir (out_root)
-    map (os.mkdir, [os.path.join (out_root, d) for d in dirs])
+    if not os.path.exists (out_root):
+        os.mkdir (out_root)
+    for d in dirs:
+        new_dir = os.path.join (out_root, d)
+        if not os.path.exists (new_dir):
+            os.mkdir (new_dir)
     for f in hardlinked_files:
-        os.link (f, strip_file_name[t] (f))
+        if not os.path.isfile (strip_file_name[t] (f)):
+            os.link (f, strip_file_name[t] (f))
     for l in symlinks:
         p = mirrortree.new_link_path (os.path.normpath (os.readlink (l)), os.path.dirname (l), strip_re)
         dest = strip_file_name[t] (l)
-        if not os.path.exists (dest):
+        if not os.path.lexists (dest):
             os.symlink (p, dest)
 
-    ## ad-hoc renaming to make xrefs between PDFs work
-    os.rename (os.path.join (out_root, 'input/lsr/lilypond-snippets.pdf'),
-               os.path.join (out_root, 'Documentation/user/lilypond-snippets.pdf'))
 
 # need this for content negotiation with documentation index
 if 'online' in targets: