summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2023-03-27 16:11:49 +0100
committerChris Liddell <chris.liddell@artifex.com>2023-03-28 14:33:10 +0100
commit3df0523f3da7536554c3f932a18c8d2fbd7cd5ec (patch)
treeddbdd420cf48a200ecef608f41dd225af077e67f /doc
parent265f7a0e11d01c09650a932a4978eed23e61fbbb (diff)
downloadghostpdl-3df0523f3da7536554c3f932a18c8d2fbd7cd5ec.tar.gz
Have the docs grab the version number from base/version.mak
And set the ending copyright date automatically.
Diffstat (limited to 'doc')
-rw-r--r--doc/src/conf.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/doc/src/conf.py b/doc/src/conf.py
index 46fe32dff..a20a19ae9 100644
--- a/doc/src/conf.py
+++ b/doc/src/conf.py
@@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
#
+import re
import sys
import os
+import datetime
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@@ -42,14 +44,34 @@ master_doc = "toc"
# General information about the project.
project = "Ghostscript"
-copyright = "1988-2022, Artifex"
+thisday = datetime.date.today()
+
+copyright = "1988-" + str(thisday.year) + ", Artifex"
# 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 full version, including alpha/beta/rc tags.
-release = "10.02.0"
+major = None
+minor = None
+patch = None
+
+_path = os.path.abspath(f'{__file__}/../../../base/version.mak')
+with open(_path) as f:
+ for line in f:
+ if not major:
+ major = re.search('GS_VERSION_MAJOR=([0-9]+$)', line)
+ if not minor:
+ minor = re.search('GS_VERSION_MINOR=([0-9]+$)', line)
+ if not patch:
+ patch = re.search('GS_VERSION_PATCH=([0-9]+$)', line)
+
+ if major and minor and patch:
+ release = major.group(1) + "." + minor.group(1) + "." + patch.group(1)
+ print(f'{__file__}: setting version from {_path}: {release}')
+ else:
+ raise Exception(f'Failed to find `Ghostscript version = ...` in {_path}')
# The short X.Y version
version = release