diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-04-12 20:00:08 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-04-12 20:37:05 +0200 |
| commit | 629664bd50ed4e72cffc33bf2e7082119d483469 (patch) | |
| tree | ef2d3a67c6e2e5030a1c542812980b4db1258db2 /repo/www/generate-deps.py | |
| parent | 05e08f7a2aa8caa8479501ccc6123baed695a06d (diff) | |
| download | memory-leaks-629664bd50ed4e72cffc33bf2e7082119d483469.tar.xz | |
Finish fixing some files being inaccessible
Make generate-deps.py compute the list of indices instead of relying
on the list of source folders that contain text files, otherwise we
will miss intermediate folders that do not contain any file.
Remove TODO entry to maintain Makefile dependencies to scripts: that
sounds too tedious. Let's assume that at some point the Makefile and
these scripts will be bundled together into a proper package.
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) |
