X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=buildscripts%2Fwww_post.py;h=278895aff93b7cc51ea73e9cd980fe932cfa2e0b;hb=91708b30fba67f8fd589980e03ff420c26473a5a;hp=39c0747d7e309ad19185765f1f823ddf6ae36e64;hpb=be8e0ed9c4d9bf06fb150e1f0d3cfe1518dfc3a7;p=lilypond.git diff --git a/buildscripts/www_post.py b/buildscripts/www_post.py index 39c0747d7e..278895aff9 100644 --- a/buildscripts/www_post.py +++ b/buildscripts/www_post.py @@ -17,17 +17,25 @@ outdir = os.path.normpath (outdir) doc_dirs = ['input', 'Documentation', outdir] target_pattern = os.path.join (outdir, '%s-root') +# these redirection pages allow to go back to the documentation index +# from HTML manuals/snippets page 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'): - ''' -Redirecting to the documentation index...\n''', os.path.join (outdir, 'index.html'): - ''' + ''' Redirecting to the documentation index...\n''', os.path.join (outdir, 'VERSION'): - package_version + '\n' } + package_version + '\n', + os.path.join ('input', 'lsr', outdir, 'index.html'): + ''' +Redirecting to the documentation index...\n''' + } + +import langdefs + +for l in langdefs.LANGUAGES: + static_files[os.path.join ('Documentation', 'user', outdir, l.file_name ('index', '.html'))] = \ + '\nRedirecting to the documentation index...\n' for f, contents in static_files.items (): open (f, 'w').write (contents) @@ -36,15 +44,14 @@ 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|.*?[.]t2d|\w*?-root)(/|$)', find_files = r'.*?\.(?:midi|html|pdf|png|txt|ly|signature)$|VERSION', - exclude_files = r'lily-[0-9a-f]+.*\.pdf') + exclude_files = r'lily-[0-9a-f]+.*\.(pdf|txt)') # actual mirrorring stuff html_files = [] @@ -57,7 +64,7 @@ for f in files: dirs = [re.sub ('/' + outdir, '', d) for d in dirs] while outdir in dirs: dirs.remove (outdir) -dirs = list( set (dirs)) +dirs = list (set (dirs)) dirs.sort () strip_file_name = {} @@ -71,7 +78,13 @@ for t in targets: 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) - os.symlink (p, strip_file_name[t] (l)) + dest = strip_file_name[t] (l) + if not os.path.exists (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: