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") as outfd, infile.open() as infd:
 
  17         print("#", title, file=outfd)
 
  21             docpos = line.find('#DOCS:')
 
  23                 line = line[docpos + 6:]
 
  24             elif line == '#' or line.startswith('#!'):
 
  26             elif line.startswith('# '):
 
  28             if line or not has_empty:
 
  29                 print(line, file=outfd)
 
  30                 has_empty = not bool(line)
 
  32     mkdocs_gen_files.set_edit_path(outfile, "docs/mk_install_instructions.py")