From badd5b6eb079e26905022c00c2c1e45b95ccc016 Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Thu, 5 Oct 2023 08:55:56 +0200 Subject: [PATCH] - add ability to specify additional RTD build options --- config/README.rst | 17 ++++++++++++++++- config/config-package.py | 8 ++++++-- config/default/readthedocs.yaml.j2 | 5 +++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/config/README.rst b/config/README.rst index 33820b8..58b8062 100644 --- a/config/README.rst +++ b/config/README.rst @@ -377,6 +377,12 @@ updated. Example: "*.mo", ] + [readthedocs] + build-extra = [ + "apt_packages:", + " - libldap2-dev", + ] + Meta Options ```````````` @@ -688,7 +694,6 @@ options (Additional) options used to configure ``zest.releaser``. This option has to be a list of strings and defaults to an empty list. - git options ``````````` @@ -698,6 +703,16 @@ ignore Additional lines to be added to the ``.gitignore`` file. This option has to be a list of strings and defaults to an empty list. +ReadTheDocs options +``````````````````` + +The corresponding section is named: ``[readthedocs]``. + +build-extra + Additional lines to be added to the ``build`` configuration in the + ReadTheDocs configuration file ``.readthedocs.yaml``. This option has to + be a list of strings and defaults to an empty list. + Hints ----- diff --git a/config/config-package.py b/config/config-package.py index 0a8d0f3..b850fee 100755 --- a/config/config-package.py +++ b/config/config-package.py @@ -332,9 +332,13 @@ def gitignore(self): ) def readthedocs(self): + build_extra = self.cfg_option( + 'readthedocs', 'build-extra', default=[]) self.copy_with_meta( - 'readthedocs.yaml.j2', self.path / '.readthedocs.yaml', - self.config_type + 'readthedocs.yaml.j2', + self.path / '.readthedocs.yaml', + self.config_type, + build_extra=build_extra, ) def coveragerc(self): diff --git a/config/default/readthedocs.yaml.j2 b/config/default/readthedocs.yaml.j2 index eb6674b..36707af 100644 --- a/config/default/readthedocs.yaml.j2 +++ b/config/default/readthedocs.yaml.j2 @@ -9,6 +9,11 @@ build: os: ubuntu-22.04 tools: python: "3.11" +{% if build_extra %} + {% for line in build_extra %} + %(line)s + {% endfor %} +{% endif %} # Build documentation in the docs/ directory with Sphinx sphinx: