aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@plc2.de>2021-12-12 14:49:45 +0100
committerPatrick Lehmann <Patrick.Lehmann@plc2.de>2021-12-12 14:50:05 +0100
commit157d01b634da67cc06267f9f87bdd6c6b791f559 (patch)
tree2118c7a80892a68eba2a1edc8a282e0049aabaab /doc
parentb6dcce607c96ce751fc3bb9aef45848c94e0e71e (diff)
downloadghdl-157d01b634da67cc06267f9f87bdd6c6b791f559.tar.gz
ghdl-157d01b634da67cc06267f9f87bdd6c6b791f559.tar.bz2
ghdl-157d01b634da67cc06267f9f87bdd6c6b791f559.zip
Using pyTooling.Packaging in conf.py.
Diffstat (limited to 'doc')
-rw-r--r--doc/conf.py36
1 files changed, 14 insertions, 22 deletions
diff --git a/doc/conf.py b/doc/conf.py
index 20b75ff6e..6cdd5b2bf 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
-import sys, re
+import sys
from os.path import abspath
from pathlib import Path
from json import loads
+from pyTooling.Packaging import extractVersionInformation
# 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
@@ -14,31 +15,22 @@ sys.path.insert(0, abspath('../pyGHDL'))
# ==============================================================================
-# Project information
-# ==============================================================================
-project = u'GHDL'
-copyright = u'2002-2021, Tristan Gingold and contributors'
-author = u'Tristan Gingold and contributors'
-
-# ==============================================================================
-# Versioning
+# Project information and versioning
# ==============================================================================
# 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.
-try:
- with open('../configure') as verin:
- for line in verin:
- line = re.findall(r'ghdl_version=\"([0-9].+)\"', line)
- if line:
- version = line[0]
- break
-except Exception as e:
- print('cannot extract version: %s' % e)
- version = "latest"
- pass
-
-release = version # The full version, including alpha/beta/rc tags.
+project = "GHDL"
+
+# Read __version__ from source file
+packageInformationFile = Path(f"../py{project}/__init__.py")
+versionInformation = extractVersionInformation(packageInformationFile)
+
+author = versionInformation.Author
+copyright = versionInformation.Copyright
+version = ".".join(versionInformation.Version.split(".")[:2]) # e.g. 2.3 The short X.Y version.
+release = versionInformation.Version
+
# ==============================================================================
# Miscellaneous settings