Automatically update documentation version number.
import sys
import os
import shlex
+import re
# 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
@@ -52,17 +53,25 @@ master_doc = 'index'
# General information about the project.
project = u'libtcod'
-copyright = u'2017, Richard Tew'
+copyright = u'2008-2018, Richard Tew'
author = u'Richard Tew'
# 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.
-#
+
+# Just grab the version string from libtcod_version.h
+match = re.match(
+ pattern=r'.*TCOD_STRVERSION *"(?P<release>(?P<version>\d+\.\d+)[^"]*)',
+ string=open('../include/libtcod_version.h').read(),
+ flags=re.DOTALL,
+)
+assert match
+
# The short X.Y version.
-version = '1.6.4'
+version = match.group('version')
# The full version, including alpha/beta/rc tags.
-release = '1.6.4'
+release = match.group('release')
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
