diff options
Diffstat (limited to 'repo/www/generate-deps.py')
| -rwxr-xr-x | repo/www/generate-deps.py | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/repo/www/generate-deps.py b/repo/www/generate-deps.py index f17e950..8388c40 100755 --- a/repo/www/generate-deps.py +++ b/repo/www/generate-deps.py @@ -5,11 +5,17 @@ We want to compute: - a list of leaf pages, -- a list of auto-generated indices, -- dependencies for leaf pages: + +- a list of indices, + +- dependencies for leaf pages (READMEs excluded): OUTPUT/foo/bar.html: foo/bar.txt | OUTPUT/foo - - special case for READMEs: - OUTPUT/foo/index.html: foo/README.txt foo | OUTPUT/foo + +- dependencies for READMEs: + OUTPUT/foo/index.html: foo/README.txt foo | OUTPUT/foo + +- dependencies for autogenerated indices: + OUTPUT/foo/index.html: foo | OUTPUT/foo """ from os import path @@ -36,7 +42,8 @@ def pjoin(directory, item): def write_dependencies(deps_file, directories, top_dir, out_dir): - pages = list() + pages = [] + readmes = {} for dpath, d in directories.items(): src_dir = pjoin(top_dir, dpath) @@ -47,8 +54,7 @@ def write_dependencies(deps_file, directories, top_dir, out_dir): name, _ = path.splitext(f) if name == 'README': - html_path = path.join(html_dir, 'index.html') - print(f'{html_path}: {src_path}', file=deps_file) + readmes[dpath] = f continue html_path = path.join(html_dir, name+'.html') @@ -56,8 +62,26 @@ def write_dependencies(deps_file, directories, top_dir, out_dir): pages.append(html_path) print(file=deps_file) + + for dpath in directories: + src_dir = pjoin(top_dir, dpath) + html_dir = pjoin(out_dir, dpath) + html_path = path.join(html_dir, 'index.html') + + if dpath in readmes: + src_path = path.join(src_dir, readmes[dpath]) + print(f'{html_path}: {src_path} {src_dir} | {html_dir}', file=deps_file) + continue + + print(f'{html_path}: {src_dir} | {html_dir}', file=deps_file) + + print(file=deps_file) + print(f'pages = {" ".join(pages)}', file=deps_file) + indices = (path.join(out_dir, dpath, 'index.html') for dpath in directories) + print(f'indices = {" ".join(indices)}', file=deps_file) + def main(arguments): extensions, out_dir = parse_arguments(arguments) |
