2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[#3812] Update doc/sphinx/conf.py for Meson

This commit is contained in:
Andrei Pavel
2025-04-03 11:41:40 +03:00
parent bd82578520
commit 210d2ab2ac
3 changed files with 33 additions and 27 deletions

View File

@@ -20,7 +20,7 @@ instructions, please refer to this `Knowledgebase article <https://kb.isc.org/do
ISC maintains two types of repositories: stable and development.
The stable repositories contain a single stable release (e.g.,
kea-2-4 or kea-2-6) along with all its maintenance updates.
kea-2-6 or kea-3-0) along with all its maintenance updates.
Separate repositories were introduced to minimize the risk of
unintentionally upgrading from one stable release to another.

View File

@@ -58,10 +58,10 @@ easier to install Kea using native packages.
1. Go to `Kea on cloudsmith.io <https://cloudsmith.io/~isc/repos/>`__.
2. Choose the Cloudsmith repository e.g. |cloudsmith_repo| for Kea |version|. Or kea-2-4 for Kea 2.4.
2. Choose the Cloudsmith repository e.g. |cloudsmith_repo| for Kea |version|.
.. note::
All stable releases are stored in separate repositories, such as kea-2-4, kea-2-6, and so on.
All stable releases are stored in separate repositories, such as kea-2-6, kea-3-0, and so on.
All development releases, which are not recommended for production use,
are located in the kea-dev repository.
@@ -71,8 +71,8 @@ easier to install Kea using native packages.
4. Follow the onscreen instructions.
.. note::
For example, the Debian setup instructions for Kea 2.4 can be found here:
https://cloudsmith.io/~isc/repos/kea-2-4/setup/#formats-deb
For example, the Debian setup instructions for Kea 3.0 can be found here:
https://cloudsmith.io/~isc/repos/kea-3-0/setup/#formats-deb
The dropdown near the top of the page offers instructions for
other operating systems.

View File

@@ -7,6 +7,7 @@
# http://www.sphinx-doc.org/en/master/config
import os
import re
import sys
from shutil import copyfile
@@ -30,29 +31,34 @@ copyright = '2019-2025, Internet Systems Consortium' # pylint: disable=redefine
author = 'Internet Systems Consortium'
# get current kea version
config_ac_path = '../../configure.ac'
meson_build_path = '../../meson.build'
changelog_path = '../../ChangeLog'
release = 'UNRELEASED'
with open(config_ac_path, encoding='utf-8') as f:
with open(meson_build_path, encoding='utf-8') as f:
version = None
for line in f.readlines():
if line.startswith('AC_INIT(kea'):
parts = line.split(',')
release = parts[1].strip()
# If the first line of the ChangeLog announces release, it means
# that this is the final release.
dash_parts = release.split('-')
candidate_release = dash_parts[0]
with open(changelog_path, encoding='utf-8') as changelog_file:
first_line = changelog_file.readline()
if candidate_release in first_line and "released" in first_line:
release = candidate_release
m = re.search(r"version: '([0-9.]+)(|-git)',", line)
if m is not None:
version = m.group(1)
break
version = release
dashed_version_series = '-'.join(version.split('.')[0:2])
if version is None:
print('ERROR: Cannot determine Kea version from meson.build.')
sys.exit(1)
release = version
# If the first line of the ChangeLog announces release, it means
# that this is the final release.
dash_parts = version.split('-')
candidate_release = dash_parts[0]
with open(changelog_path, encoding='utf-8') as changelog_file:
first_line = changelog_file.readline()
if candidate_release in first_line and "released" in first_line:
version = candidate_release
cloudsmith_series = '-'.join(version.split('.')[0:2])
# now let's replace versions with odd minor number with dev
if int(dashed_version_series[-1]) % 2 != 0:
dashed_version_series = 'dev'
if int(cloudsmith_series[-1]) % 2 != 0:
cloudsmith_series = 'dev'
# -- General configuration ---------------------------------------------------
@@ -245,13 +251,13 @@ todo_include_todos = True
# -- Substitutions -----------------------------------------------------------
rst_prolog = """
.. |cloudsmith_repo| replace:: kea-{dashed_version_series}
""".format(dashed_version_series=dashed_version_series)
.. |cloudsmith_repo| replace:: kea-{cloudsmith_series}
""".format(cloudsmith_series=cloudsmith_series)
# -- Functions ---------------------------------------------------------------
# Do generation of api.rst and kea-messages.rst here in conf.py instead of Makefile.am
# Do generation of api.rst and kea-messages.rst here in conf.py instead of meson.build
# so they are available on ReadTheDocs as there makefiles are not used for building docs.
def run_generate_docs(_):
with open(os.path.join(SRC_DIR, 'api-files.txt'), encoding='utf-8') as af:
@@ -263,7 +269,7 @@ def run_generate_docs(_):
# 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
# users. Furthermore, ReadTheDocs does not use the makefile system at all and they rely
# on sphinx-build only. As a result we need to conduct some Makefile-like operations
# on sphinx-build only. As a result we need to conduct some Meson-like operations
# here. This requires us to copy (or link) the file from the top level to sphinx subdir.
#
# The first entry on this list is the actual file to copy, the second is a unique name