From e2c473244a16d364b747e037e5dd6613d55898f0 Mon Sep 17 00:00:00 2001 From: Philip Cook Date: Wed, 11 Dec 2024 12:11:03 -0500 Subject: [PATCH] DOC: Update conf.py Trying out some code to put the correct version information in the RTD PDFs --- docs/source/conf.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index d714c134..11ad4503 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -74,19 +74,33 @@ # General information about the project. project = 'ANTsPy' -copyright = '2017, ANTs Contributors' +copyright = '2017-2024, ANTs Contributors' author = 'ANTs Contributors' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # -# The short X.Y version. -# TODO: change to [:2] at v1.0 -version = 'master (0.1.3)' -# The full version, including alpha/beta/rc tags. -# TODO: verify this works as expected -release = 'master' +# Default values for local builds +version = 'local' +release = 'local' + +# Determine if we are on Read the Docs +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' + +if on_rtd: + rtd_version = os.environ.get('READTHEDOCS_VERSION', 'local') + rtd_version_type = os.environ.get('READTHEDOCS_VERSION_TYPE', 'branch') + + if rtd_version_type == 'tag': + version = rtd_version.lstrip('v') + release = f'release {version}' + elif rtd_version_type == 'branch' and rtd_version == 'latest': + version = 'dev' + release = f'dev ({rtd_version})' + else: + version = rtd_version + release = rtd_version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages.