2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-02 15:05:16 +00:00

[#1945] generate kea-messages.rst a priori

This allows us to document premium messages in the public ARM without
having to hand out a copy of the premium sources to readthedocs.
This commit is contained in:
Andrei Pavel
2024-08-19 18:34:39 +03:00
parent 79b57e5f8d
commit a56fb8d6c6
4 changed files with 25704 additions and 9 deletions

View File

@@ -1,3 +1,2 @@
/_build /_build
/api.rst /api.rst
/kea-messages.rst

View File

@@ -22,7 +22,6 @@ SRC_DIR = os.path.abspath(os.path.dirname(__file__))
sys.path.append(SRC_DIR) sys.path.append(SRC_DIR)
import api2doc # noqa # pylint: disable=wrong-import-position import api2doc # noqa # pylint: disable=wrong-import-position
import mes2doc # noqa # pylint: disable=wrong-import-position
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
@@ -260,11 +259,6 @@ def run_generate_docs(_):
api_files = [os.path.abspath(os.path.join(SRC_DIR, '../..', af)) for af in api_files] api_files = [os.path.abspath(os.path.join(SRC_DIR, '../..', af)) for af in api_files]
api2doc.generate(api_files, os.path.join(SRC_DIR, 'api.rst')) api2doc.generate(api_files, os.path.join(SRC_DIR, 'api.rst'))
with open(os.path.join(SRC_DIR, 'mes-files.txt'), encoding='utf-8') as mf:
mes_files = mf.read().split()
mes_files = [os.path.abspath(os.path.join(SRC_DIR, '../..', mf)) for mf in mes_files]
mes2doc.generate(mes_files, os.path.join(SRC_DIR, 'kea-messages.rst'))
# Sphinx has some limitations. It can't import files from outside its directory, which # Sphinx has some limitations. It can't import files from outside its directory, which
# in our case is src/sphinx. On the other hand, we need to have platforms.rst file # in our case is src/sphinx. On the other hand, we need to have platforms.rst file
# in top level directory, so it's easily accessible by prospective and first time # in top level directory, so it's easily accessible by prospective and first time

25697
doc/sphinx/kea-messages.rst Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -20,8 +20,9 @@
# If no output file is specified, output is written to stdout. # If no output file is specified, output is written to stdout.
# The produced format is ReStructuredText. # The produced format is ReStructuredText.
import re
import argparse import argparse
import pathlib
import re
def parse_args(): def parse_args():
@@ -36,8 +37,12 @@ def parse_args():
def read_input_files(files): def read_input_files(files):
messages = {} messages = {}
for f in files: for f in files:
if '/premium/' in f and not pathlib.Path(f).is_file():
# Premium can be missing which is fine for daily development, and CI tasks.
print(f'Ignoring non-existing file {f}')
continue
with open(f, encoding='utf-8') as fp: with open(f, encoding='utf-8') as fp:
print("Processing %s" % f) print(f'Processing {f}')
msg_descr = None msg_descr = None
msg_id = None msg_id = None
msg_text = None msg_text = None