1 # SPDX-License-Identifier: GPL-3.0-or-later
3 # This file is part of Nominatim. (https://nominatim.org)
5 # Copyright (C) 2024 by the Nominatim developer community.
6 from pathlib import Path
8 import mkdocs_gen_files
10 VAGRANT_PATH = Path(__file__, '..', '..', 'vagrant').resolve()
12 for infile in VAGRANT_PATH.glob('Install-on-*.sh'):
13 outfile = f"admin/{infile.stem}.md"
14 title = infile.stem.replace('-', ' ')
16 with mkdocs_gen_files.open(outfile, "w", encoding='utf-8') as outfd, \
17 infile.open(encoding='utf-8') as infd:
18 print("#", title, file=outfd)
22 docpos = line.find('#DOCS:')
24 line = line[docpos + 6:]
25 elif line == '#' or line.startswith('#!'):
27 elif line.startswith('# '):
29 if line or not has_empty:
30 print(line, file=outfd)
31 has_empty = not bool(line)
33 mkdocs_gen_files.set_edit_path(outfile, "docs/mk_install_instructions.py")