Skip to content

Commit

Permalink
DOC: Update conf.py
Browse files Browse the repository at this point in the history
Trying out some code to put the correct version information in the RTD PDFs
  • Loading branch information
cookpa authored Dec 11, 2024
1 parent 80826f5 commit e2c4732
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e2c4732

Please sign in to comment.