Music production session manager https://www.laborejo.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
4.1KB

  1. #! /usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. This documentation is licensed under Creative Commons-BY-SA-4.0.
  5. Please read the provided documentation/LICENSE file or visit
  6. https://creativecommons.org/licenses/by-sa/4.0/legalcode
  7. The documentation is built statically and does not belong to the normal build process with configure and make
  8. Its updating is part of the development process, not packaging and running.
  9. The correct out/ dir is already part of git.
  10. .adoc is asciidoctor, not simple asciidoc.
  11. """
  12. #Make the readme
  13. import sys
  14. sys.path.append("../engine")
  15. from config import METADATA
  16. import subprocess
  17. from os import getcwd
  18. import os.path
  19. assert os.path.exists(os.path.join(getcwd(), __file__)), (getcwd(), __file__)
  20. import datetime
  21. #Readme
  22. with open("readme.template", "r") as r:
  23. template_readme = r.read()
  24. template_readme = template_readme.replace("<date>", datetime.datetime.now().isoformat())
  25. template_readme = template_readme.replace("<name>", METADATA["name"])
  26. template_readme = template_readme.replace("<version>", METADATA["version"])
  27. template_readme = template_readme.replace("<shortname>", METADATA["shortName"])
  28. template_readme = template_readme.replace("<description>", METADATA["description"])
  29. template_readme = template_readme.replace("<dependencies>", METADATA["dependencies"])
  30. template_readme = template_readme.replace("<author>", METADATA["author"])
  31. with open ("../README.md", "w") as w:
  32. w.write(template_readme)
  33. print ("Built /README.md")
  34. #Documentation index
  35. with open("index.adoc.template", "r") as r:
  36. template_index = r.read()
  37. template_index = template_index.replace("<name>", METADATA["name"])
  38. template_index = template_index.replace("<shortname>", METADATA["shortName"])
  39. template_index = template_index.replace("<version>", METADATA["version"])
  40. template_index = template_index.replace("<author>", METADATA["author"])
  41. with open ("index.adoc", "w") as w:
  42. w.write(template_index)
  43. #Documentation
  44. METADATA["supportedLanguages"].update({"English":""})
  45. for language in METADATA["supportedLanguages"].keys():
  46. language = language.lower()
  47. try:
  48. with open(f"{language}.adoc.template", "r") as r:
  49. template = r.read()
  50. except:
  51. continue #language not yet supported as manual
  52. for key, value in METADATA.items(): #all strings
  53. if type(value) is str:
  54. template = template.replace(f"<{key}>", value)
  55. if language == "english":
  56. template = template.replace("<english-only-description>", "== Introduction\n\n" + METADATA["description"])
  57. with open (f"{language}.part.adoc", "r") as clientPart:
  58. template = template.replace("<manual>", clientPart.read())
  59. with open (f"{language}.adoc", "w") as w:
  60. w.write(template)
  61. #Create manpage
  62. #Needs help2man
  63. manpage_template = f"""
  64. [name]
  65. {METADATA["name"]} - {METADATA["tagline"]}
  66. [usage]
  67. {METADATA["description"]}
  68. [Reporting bugs]
  69. https://www.laborejo.org/bugs
  70. [copyright]
  71. {METADATA["name"]} {METADATA["version"]} - Copyright {METADATA["year"]}
  72. {METADATA["author"]}
  73. https://www.laborejo.org/
  74. [examples]
  75. Run agordejo. You are now in the Quick View mode. Press New Session and add programs through a
  76. single click on available program-icons. You can switch to the Full View mode via the tab to
  77. get more options. Try right-clicking on many things to get context menus.
  78. [see also]
  79. The full documentation for {METADATA["name"]} is maintained as a multi-lingual html site to your systems doc-dir.
  80. For example:
  81. xdg-open file:///usr/share/doc/{METADATA["shortName"]}/index.html
  82. The documentation can also be found online https://www.laborejo.org/documentation/{METADATA["shortName"]}
  83. """
  84. with open ("manpageinclude.h2m", "w") as w:
  85. w.write(manpage_template)
  86. command = f"help2man ../{METADATA['shortName']} --no-info --include manpageinclude.h2m > {METADATA['shortName']}.1"
  87. subprocess.run(command, capture_output=True, text=True, shell=True)
  88. #help2man for the much simpler nsm-data
  89. commandNsmDataMNan = "help2man ../tools/nsm-data --no-info > nsm-data.1"
  90. subprocess.run(commandNsmDataMNan, capture_output=True, text=True, shell=True)
  91. print ("Built. You still need to run")
  92. print ("sh build-documentation.sh")